Home › Topics › Firewall Monitoring Beyond Up/Down › Rule-Hit Analysis

Rule-Hit Analysis: What Your Firewall Actually Does All Day


Open your firewall's rule list and scroll. Keep scrolling. Somewhere past the rules you wrote, you will find rules your predecessor wrote and rules their predecessor wrote. There are rules named things like temp-allow-DO-NOT-DELETE, and rules permitting traffic to servers that were recycled years' worth of hardware refreshes ago. A firewall ruleset is an archaeology site. Every layer records something somebody once urgently needed, and nobody remembers which layers still matter.


Here is the good news: the firewall itself has been keeping score the whole time. Nearly every product maintains a hit counter per rule — a simple tally of how many times each rule has matched traffic. Those counters are the closest thing you will ever get to an honest answer to the question "what does this firewall actually do all day?" They reveal which rules carry the network, which are dead weight, and which are quietly being smothered by a broader rule above them.


This guide shows you how to read them. You will learn what hit counters do and do not tell you. You will learn how to hunt dead rules without deleting the one that saves you during a disaster. The guide explains how shadowed rules happen and how to spot them. It shows how to fold hit data into a periodic review that keeps the ruleset honest. You will also learn which deny hits deserve a closer look. No security budget required — just counters you already own and a little method.


In this guide

  • Hit counters: the firewall's diary
  • Reading the surprising top ten
  • Dead rules — and the trap of deleting them
  • Shadowed rules in plain language
  • A periodic rule review that actually happens
  • A worked example: three quiet rules, three verdicts
  • Deny hits worth investigating
  • Keeping the ruleset small enough to reason about

Hit counters: the firewall's diary


A firewall evaluates traffic against its rules and, when a rule matches, does what the rule says — allow, deny, inspect, log. The hit counter simply increments each time that happens. Most products show the count next to each rule in the management interface and expose it at the CLI. They often track a "last hit" time alongside. Some count sessions (one tally per new conversation), and some count packets. For analysis purposes either works, as long as you compare rules counted the same way.


Before you trust the numbers, learn what resets them on your product. Counters commonly go back to zero on a reboot. Sometimes they reset after a failover to the other member of a high-availability pair, or when an admin clears them by hand. On some products they reset when the rule itself is edited. This matters enormously for dead-rule hunting. A rule showing zero hits means "zero since the counters last reset," which might be two years or two hours. Step one of any serious analysis is establishing the observation window. Note the counter-reset time (or clear them deliberately and write down the date in your change log). That gives "zero hits" a denominator.


One more honesty note: hit counters tell you a rule matched, not that the traffic was good. A heavily-hit allow rule might be carrying the business or carrying an infection. A heavily-hit deny might be doing vital work or absorbing harmless noise. Counters are the map. You still have to walk the ground.


Reading the surprising top ten


Sort your rules by hit count, descending, and look at the top ten. For most admins doing this the first time, at least one entry is a genuine surprise. It might be a rule you barely remember near the top, or the rule you think of as "the important one" nowhere in sight. A generic listing looks like this:


fw01> show rule hit-counts sort-by hits
#    Name                      Action   Hits           Last hit
2    allow-web-out             allow    48,211,904     seconds ago
1    allow-dns-to-resolvers    allow    9,882,131      seconds ago
57   deny-all-default          deny     6,455,880      seconds ago
9    allow-cloud-backup        allow    3,014,227      seconds ago
3    allow-mail-in             allow    1,204,551      minutes ago
...
41   allow-vendor-support      allow    12             long ago
42   allow-legacy-erp          allow    0              never

Read it as a story. The top handful of rules almost always carry the overwhelming share of all traffic — that is normal and healthy. The questions worth asking: does each top rule's name and intent match what it is evidently doing? (A rule called temp-printer-fix sitting at number three is telling you it is not temporary and probably not about printers anymore.) Is anything in the top ten broader than it needs to be, now that you can see it matches millions of times? And is the final catch-all deny busy or eerily quiet? A busy one is expected on an internet-facing firewall. An eerily quiet one can mean a too-generous allow above it is swallowing what should have been blocked.


Here is one practical aside while you are looking at the heavy hitters. On many products, rules are evaluated top-down until one matches. On those products, a busy rule buried deep in the list means extra matching work on nearly every new connection. Moving the heaviest legitimate rules toward the top can genuinely lighten the load on such platforms — but two cautions before you touch anything. Some firewalls compile the whole ruleset into an optimized structure, making order irrelevant to performance. Check how yours behaves before rearranging for speed. And order is never just performance — moving a rule changes which traffic reaches the rules below it. Policy correctness first, milliseconds second, always.


The bottom of the sorted list is just as informative, and that is where we go next.


Dead rules — and the trap of deleting them


A rule with zero hits across a long observation window is a dead rule candidate. The traffic it describes apparently no longer exists. Dead rules accumulate for mundane reasons — the server was decommissioned, the vendor contract ended, the project got cancelled, the "temporary" exception outlived the emergency. Each one is a small cost: it makes the ruleset longer to read, slower to audit, and riskier to change. And if it is an allow, it is an open door standing in front of a room that might get refurnished someday. Cleanup is genuinely worth doing.


And yet: the most dangerous command in firewall administration might be "delete unused rule." Because here is the honest caution — some of your most critical rules are supposed to have zero hits. The rule allowing replication to the disaster-recovery site that only activates during a failover. The break-glass rule for the out-of-band management path. The allowance for the annual audit tooling, or the payroll system's quarterly interface. Zero hits does not mean zero value. It can mean the rule is a fire escape, and fire escapes are not judged by daily foot traffic.


The way through is process, not courage:


  • Research before touching. For each zero-hit rule, hunt for an owner, a ticket, or a comment. A rule nobody can explain is a finding in itself — but not yet a deletion.
  • Disable, don't delete. Disabling keeps the rule on file, ready to re-enable in seconds when the DR test fails at the worst moment. Deletion means reconstructing it from memory during that same moment.
  • Wait out a full business cycle. Rarely-used rules fire on rhythms — end of quarter, year-end close, annual failover drills. Let the disabled rule sit through the longest cycle your business has before it graduates to deleted.
  • Log the whole thing in change control. Which rules, when disabled, when review is due, who approved. Future-you, mid-incident, will send present-you a thank-you note.

Tip: when you disable a candidate rule, rename or comment it with the date and a contact — something like disabled-pending-removal-see-ticket-4471. The next admin who finds it at 2 AM should not need a séance to learn its story.


Shadowed rules in plain language


Firewalls evaluate rules in order and, in the common case, act on the first match. That makes rule order a silent partner in every policy decision. It creates a failure mode called shadowing. A broad rule placed higher in the list matches traffic that a narrower rule further down was written to handle. The narrow rule is unreachable. It sits in the list, looks like policy, and passes every glance-over. Yet it never fires, because the broad rule above eats every packet meant for it.


Here is the classic shape of it:


#Rule nameSourceDestinationServiceActionHits
12allow-all-web-outany internalany externalwebAllow48,211,904
31deny-guest-streamingguest networkstreaming rangeswebDeny0

Whoever wrote rule 31 believed guests were blocked from streaming. They are not, and never were. Guest web traffic matches rule 12 first, gets allowed, and rule 31's counter stays at zero forever. Nothing is "broken" — no error, no log entry, no complaint (the guests certainly are not complaining) — which is why shadowing survives for years. It is most dangerous when the shadowed rule is a deny: the ruleset documents a security control that does not exist.


Hit counters are your shadow detector. The signature is exactly what the table shows: a narrow rule with zero hits sitting below a broader, busy rule that overlaps it. When you find a zero-hit rule during dead-rule hunting, always ask the second question. Is this rule dead because the traffic stopped, or because something above is intercepting it? Read upward through the list looking for any earlier rule whose source, destination, and service ranges cover the quiet rule's. Some firewall management tools can run this overlap analysis for you. On a modest ruleset, eyeballs and a coffee do fine. The fix is usually to move the specific rule above the general one and then watch its counter start moving as proof. Specific-before-general is the ordering rule of thumb that prevents most shadowing in the first place.


A periodic rule review that actually happens


Hit analysis works best as a habit, not a heroic one-off. Rulesets drift the way desks get messy: continuously, invisibly, and faster than anyone admits. The counter-move is a modest periodic review. Quarterly is a common rhythm; twice a year is honest for a small shop. The review is tied into the same change-control process that adds rules in the first place. A review that fits in ninety minutes, run like this:


  • 1. Snapshot. Export the ruleset with hit counts and last-hit times. Save it with a date in the filename; these snapshots become your trend data.
  • 2. Read the top ten. Anything new up there? Does each heavy rule still match its stated intent? Any catch-all deny gone strangely quiet?
  • 3. List the zeros. Every zero-hit and near-zero rule goes on a worksheet with three columns: known owner, plausible seasonal purpose, shadow suspect.
  • 4. Check the shadow suspects. For each quiet narrow rule, scan upward for a busier, broader rule that covers it. Fix ordering where you find it.
  • 5. Disable with paperwork. Candidates get disabled, commented, ticketed, and scheduled for deletion after the waiting period from the previous section.
  • 6. Compare with last time. Rules disabled last review and still unmissed get deleted. New mystery rules get owners assigned. That is because every rule added since should have arrived through change control with a ticket attached. The review is where that promise gets audited.

The change-control tie-in is what keeps the archaeology from re-accumulating. If every new rule records who asked, why, and an expiry-or-review date, then future reviews stop being detective work and become bookkeeping. The counters keep everyone honest — including the rule that was "absolutely essential" and has matched nothing since it went in.


A worked example: three quiet rules, three different verdicts


To see why the process matters, walk through the quiet end of the earlier listing as a reviewer would. Three rules, all suspicious-looking, all different underneath:


Rule 41, allow-vendor-support, 12 hits, last hit long ago. Research turns up a ticket: remote access for a vendor maintaining the old phone system — a system since replaced. The handful of hits date from its final months. Verdict: disable now, comment with the ticket number, delete after the waiting period. This is the easy case, and satisfyingly common.


Rule 42, allow-legacy-erp, zero hits, never. Alarming name, no owner listed. But reading upward through the list turns up rule 8. That is a broad allowance between server networks that entirely covers rule 42's narrower source and destination. The narrow rule is not dead — it is shadowed; the ERP traffic flows fine and gets counted by rule 8. Verdict: no deletion and an ordering fix. There is also a bigger question for the review notes. Is that broad rule 8 doing too much work for anyone to see what is actually talking to what?


Rule 44, allow-dr-replication, zero hits, never. The owner is easy to find, and the answer changes the mood. This is the path the backup systems use to reach the disaster-recovery site during a failover. It has zero hits because there has been no disaster — which is the good outcome. Verdict: keep, forever, and tag it in comments as a fire-escape rule so no future reviewer has to rediscover this conversation. (Then quietly note that if it has never hit, the DR failover has never been tested through this firewall either. That observation is worth its own meeting.)


Same counter value, three verdicts: delete, reorder, protect. That spread is the whole argument for doing this with a method instead of a delete key.


Deny hits worth investigating


So far we have used counters to judge the rules. Deny counters flip the lens: they tell you about the traffic — specifically, traffic that tried and failed. Most of it is unremarkable. An internet-facing deny rule absorbs a constant drizzle of scans and probes from strangers. That is background radiation, and alerting on it would be a fast track to ignoring your alerts. But a few deny patterns are worth genuine attention. They share a theme: denies from the inside out are more interesting than denies from the outside in.


The ones worth a look include an internal server repeatedly denied trying to reach the internet. Servers rarely develop new hobbies — that pattern suggests a misconfiguration, a forgotten dependency, or a compromise phoning home. Another is one internal host racking up denies to many different destinations or ports. That is the fingerprint of scanning, and often your earliest malware signal. Denies hitting rules that protect management interfaces also deserve a look. Someone inside is knocking on doors they should not know exist. A sudden step-change in deny volume on any rule that has been stable for months also deserves a look. Something changed — find out what. Each of these earns investigation precisely because it is a change in behavior from a population you know. It is not noise from a population you never will.


Acting on these patterns means getting deny events off the firewall and somewhere you can search and alert on them. That is a logging problem more than a counter problem. The guide Firewall Logs: Alerting on What Matters covers that wiring, including how to alert on the meaningful patterns without drowning in the drizzle.


Keeping the ruleset small enough to reason about


Behind all of this is one quiet principle: a ruleset is only as safe as your ability to understand it. Every rule is a standing promise the firewall keeps forever, and every extra rule multiplies the interactions you must consider before changing anything. Past a certain length — and every admin knows the feeling when their ruleset crosses it — nobody fully understands the policy anymore. Changes get scarier, so people stop removing things. So it grows faster. That is how a firewall ends up with hundreds of rules and one very nervous administrator.


Hit analysis is the maintenance half of the answer. The prevention half is craft. Use named object groups ("payroll-servers", "branch-networks") instead of raw addresses, so ten similar rules collapse into one readable one. Give rules names and comments a stranger could follow. Put the specific above the general as a standing convention. And let every temporary rule carry an expiry the review will enforce. Here is the test worth aspiring to. A competent new hire should be able to read the whole ruleset in one sitting and correctly say what your organization's policy is. If that sounds impossible today, you have found your backlog — and the counters just handed you the safe order to work through it.


Where to go next


Rule-hit analysis is the "what is it doing?" half of firewall monitoring. The "how is it coping?" half covers CPU under inspection load, memory, session tables, and hardware. That half lives in Firewall Health: The Metrics Behind the Little Green Light and Session Tables and Connection Limits. A leaner ruleset helps there too: less matching work and fewer logging decisions per packet. The full series lives at Firewall Monitoring Beyond Up/Down.


Put this into practice with SysPeep Monitor

Rule cleanup is careful, human work — but babysitting the firewall's vital signs while you do it should not be. SysPeep Monitor watches your firewall's CPU, memory, session counts, and interfaces over SNMP. Its thresholds and alert rules are built to stay quiet until something genuinely drifts. Keep your attention on the ruleset; the free trial installs on any Windows machine in minutes.

Download Free TrialLearn About SysPeep