Back to Technical Articles

Evidence-Based Deletion in Legacy CFML (Without Breaking Prod)

Deleting first can break production immediately if you remove a template or endpoint the app still depends on. This approach is safer: watch real usage, make a short list, deprecate in small batches, then delete after it stays quiet.

Note: This write-up was inspired by our Razuna modernization work, but the approach applies just as well to slimming down an older app in place. In our case, we did most of the cleanup during the rebuild.

Quick summary

  • Start with data: access logs plus a small “what ran” trace.
  • Keep it simple: bucket items safe / review / keep and move on.
  • Deprecate before delete: quarantine or tombstone so surprises show up as logs.
  • Delete in batches: wait out a full usage window with zero hits.

Goal

The point is to make the app smaller without changing what users can actually do. If something is truly unused, remove it. If you’re not sure, leave a tombstone for a while so you find out the easy way (a log line), not the hard way (a broken workflow).

How to think about it

Deletion is the last step. First you inventory, then you watch real traffic, then you deprecate in a reversible way.

Evidence inputs

You want two views of reality:

Access logs alone are noisy (bots, scanners, health checks). App logs alone can hide what the user asked for (forwards, rewrites, routing). Put them together and you can usually tell “nobody uses this” from “the nightly job uses this.”

What to record (minimum)

Concrete example (the kind of legacy CFML this came from)

This workflow came out of modernizing Razuna: a CFML app running on Open BlueDragon (OpenBD) inside Tomcat, with a Java 8 baseline and a separate search-server webapp. The codebase mixed a lot of .cfm templates with dispatcher-style entrypoints, and the admin UI used Fusebox-style routing (the classic fa=... “fuseaction” parameter).

That matters because a router-heavy app naturally produces a lot of “route-only” references. Those aren’t safe to delete based on static scanning alone — they’re the exact items you keep in review until logs (or a tombstone) prove they’re quiet.

What our tooling looked for (no “build” required)

In our case, we already had a pile of CFML and we wanted a short list of files that were probably dead. The tooling didn’t compile anything. It did two kinds of work: read files on disk and summarize existing access logs.

1) Entrypoint-rooted static trace

In a router-heavy CFML app (Razuna is a good example), a couple of dispatchers act like entrypoints. The trace starts from those files and then walks outward by scanning file contents for common CFML reference patterns:

The output is basically a graph: “this file refers to that file.” Anything reachable from the entrypoints is “proved reachable.” Anything not reachable becomes a candidate. The same pass also tracks unresolved references in buckets:

Example numbers from one run: ~1.3k files under the root, ~120 reachable from the two dispatchers, ~80 dynamic/unresolvable-at-scan-time references, and ~1.2k “not reached” candidates. Those candidates include plenty of non-code (images, jars, archives), which is why this is a candidate generator, not a deletion button.

2) Orphan detection (0 inbound references)

Separately from “not reached from entrypoints,” we also look for files with no inbound static references anywhere. This catches different mess: old copies, abandoned admin screens, one-off diagnostics, and assets that nothing points at anymore.

3) Access-log summaries that understand dispatch

Raw access logs are useful, but routers hide the action. If everything goes through a dispatcher, the path is always the same and the query string tells the story. So the log summary does two views:

This is where “static candidates” meet reality: if a file is a static candidate but the access logs show the route is hit (or a background job calls the endpoint), it stays in the review bucket until you understand how it’s reached.

Workflow

1) Inventory what exists

Start with a flat list of “things that could go away”: templates, handlers, admin-only screens, and job entry points. You don’t need perfect routing knowledge to begin. You just need a list you can sort and annotate.

# Example output shape (CSV/JSON is fine)
# kind,path,owner,notes
# template,/admin/foo.cfm,admin,manual-only
# endpoint,/api/v1/legacySearch,api,likely-unused

2) Capture what’s used

Pick a window that covers how the business really uses the system (two weeks is often too short; a month is usually better). Pull requested paths from access logs, then pair that with an in-app trace so you can see what code actually ran.

# Access log extraction idea (shape, not a commandment)
# - normalize to paths
# - drop query string variance
# - group counts

3) Classify candidates

Now bucket the inventory. Don’t overthink it:

4) Deprecate in phases

Don’t delete on day one. Deprecate first:

This is where the evidence feeds the decision. If something is a static “not reached” candidate and you don’t see it show up in access logs (including the dispatcher routes that would normally exercise it), it’s a good fit for quarantine/tombstoning. If the logs show it getting hit, it stays in the review bucket until you understand the path. If the only “references” are route-only or dynamic, treat it as review by default.

What “deprecate” means in practice

Either quarantine the file (so you can restore it quickly) or replace it with a tombstone that logs every hit. That turns “surprise usage” into something you can see and fix.

Here’s a simple tombstone pattern for a legacy .cfm endpoint. It returns 410 Gone and logs enough to find callers. Don’t log secrets.

<!-- deprecated-endpoint.cfm -->
<cfsetting enablecfoutputonly="true" />

<!-- Log enough to find callers; don’t log secrets. -->
<cflog file="deprecated" type="information"
    text="Deprecated endpoint hit: #cgi.script_name# ip=#cgi.remote_addr# ua=#cgi.http_user_agent#" />

<cfheader statuscode="410" statustext="Gone" />
<cfcontent type="text/plain; charset=utf-8" reset="true" />
This endpoint has been removed.

5) Delete after a quiet window

After a full window with zero hits on tombstones/quarantine items (and after you’ve checked scheduled jobs and admin-only screens), delete. Do it in small batches and keep a quick changelog so you can answer “what changed?” later.

Gotchas

Checklist

# 1) Inventory
- List templates/endpoints
- Identify scheduled jobs + callbacks

# 2) Observe
- Access logs for requested paths
- In-app trace for executed templates/controllers

# 3) Classify
- Safe / Review / Keep

# 4) Deprecate
- Dry run report
- Conservative apply
- Watch logs

# 5) Delete
- Quiet window passes
- Delete in batches
- Record what changed