Wazuh correlation rules with frequency and timeframe

Frequency rules let Wazuh raise an alert only when a repeated event crosses a threshold inside a time window, such as many failed logins from one source. This page explains the options, the SSH pattern and what to test before deployment.

On this page

Wazuh correlation rules with frequency and timeframe: when a single event is not enough

A single failed login is rarely a finding on its own. Users mistype passwords, services retry with stale credentials and scanners probe common accounts. The detection problem is repetition: many failures from one source in a short period. In Wazuh, that is handled by a correlation rule on the Wazuh server, which watches the stream of alerts from earlier rules and fires only when a condition is met across several events. The three settings that define this are frequency (how many matching events are needed), timeframe (the window in seconds in which they must occur) and same_source_ip or other same_field options (which require the repeated events to share a value such as the source address or user name). Together they turn a noisy base event into a signal that an analyst can act on.

Teams need these options when the question they are asking is about behavior over time rather than about one record: brute force against SSH or a web login, repeated privilege escalation attempts, or a host generating many errors in a short span. This page uses the SSH authentication failure pattern as its model because it shows every piece clearly: a base rule that decodes the failure, a child rule that counts repeats from the same source, and a level and description that an analyst can work from. The same structure carries over to other sources once the base event is decoded correctly.

Before you copy the pattern, confirm three things in your own environment. First, that the base rule you correlate against actually fires on the log you care about, which you can check with wazuh-logtest. Second, that the field you want to match is extracted by a decoder, because same_field cannot correlate a value the decoder did not produce. Third, that the window and count reflect how your users and systems really behave, since a threshold copied from an example will be too quiet in some networks and too loud in others. Plan a review of the thresholds after the first weeks of alerts.

Frequency, timeframe and same-field options and when each fits

This table compares the frequency, timeframe, same-field options and the parent link that Wazuh correlation rules use to count repeated events. Read each row for what the option matches, where it fits, and what it costs in alert volume or missed detections. Confirm default values in the Wazuh rule syntax reference for your version before relying on them.

OptionWhat it matchesTypical useTrade-off
frequencyThe number of matching events that must arrive before the rule firesRepeated failures, such as several failed logins before an alertToo low a count produces noisy alerts; too high can miss slow attacks
timeframeThe window in seconds in which the frequency count must be reachedBursts of activity, such as rapid scanning from one hostA short window misses spread-out activity; a long window groups unrelated events
same_source_ipEvents that share the same source IP address as the first matching eventBrute force or scanning from a single hostShared NAT or proxy addresses can group many users into one alert
same_userEvents that share the same user name as the first matching eventRepeated failures against one account, regardless of sourceAttacks spread across many accounts or many hosts may not reach the count
same_fieldEvents that share the value of a named field extracted by a decoderGrouping by a custom field such as a hostname, device or application IDThe field must be extracted reliably; a missing field silently prevents matches
if_matched_sid or if_matched_groupA parent rule or rule group that must match before this rule is evaluatedBuilding on a base rule, such as authentication failures, to narrow the correlationA broad parent produces more evaluations and alerts; a narrow parent may skip relevant events

How the SSH failure pattern works as a template

The SSH example is a two-rule pattern that you can reuse for any event that repeats. A base rule matches one decoded failure from sshd, such as a failed password or an invalid user attempt, and assigns it a low level so it is recorded but rarely alerts on its own. A child rule then sets if_matched_sid to the base rule's ID, adds a frequency (how many matches count), a timeframe (the window in seconds) and same_source_ip so the count only grows for one source address. When the threshold is crossed inside the window, the child rule fires at a higher level. Illustrative values: a base rule at level 5, and a child rule that fires after 8 matches within 120 seconds from the same source.

The parent reference is what makes the pattern work. The child rule only evaluates events that the parent has already matched, so it never has to parse sshd text itself, and a change to the decoder or base rule flows through to every child that depends on it. If the parent ID is wrong or the parent rule is disabled, the child silently stops firing, so a logtest run that shows the child matching is the simplest check to make after any edit. Confirm the parent and child IDs in your own rule files, since the sample IDs above are placeholders.

The source field decides whether the rule detects attackers or just counts noise. Without same_source_ip, failures from many hosts add up together, so a busy jump host or a service account with a stale password can trigger the rule for a single benign user. Matching on the source address separates one host hammering logins from a shared account failing in several places. Other fields, such as same_user, answer different questions, and choosing between them is a design decision you should make per detection and then validate with sample logs before deployment.

Building and deploying a frequency rule

This sequence takes a repeated-event detection from a sample log to a live alert, with a check at each stage so the rule is proven against the data it will see in production. It also keeps custom content separate from Wazuh's default ruleset so upgrades do not overwrite it.

  1. Confirm the decoder extracts the source field

    Before writing any correlation logic, check that the decoder for the log source pulls out the field you will group on, such as the source IP or the username. Run a representative log through wazuh-logtest and read the decoded fields in phase 2. If the field is missing or named differently from what you expect, fix the decoder first, because a frequency rule can only count values it can see. Done when the field appears with the expected value for every sample line you test.

  2. Write the base rule and frequency child rule

    Create a custom rules file, usually under the local rules directory, and assign IDs from the custom range (confirm the range for your installed version). Write a base rule that matches the single event, then a child rule that sets frequency, timeframe and same_field (for example, srcip) and points to the base rule with if_matched_sid. Give the child rule a clear description an analyst can act on. Done when both rules pass XML syntax checks and the rule IDs do not collide with existing ones.

  3. Replay sample logs across the timeframe

    Test the frequency logic with wazuh-logtest by feeding it a sequence of events that crosses the threshold inside the timeframe, then a second sequence that stays below it. Because the rule depends on time, replay the lines in the order and spacing they would arrive, and confirm the logtest session keeps state between inputs. Include a case where the source changes to show that same_field separates counts. Done when the child rule fires only at the threshold and does not fire for the below-threshold set.

  4. Confirm the rule file location and restart method

    Before deploying, confirm with the documentation for your installed Wazuh version where custom rule files belong and how the manager must be restarted or reloaded to read them. Copy the validated file to that path on the manager, keeping ownership and permissions consistent with the existing rule files. Do not edit the default rule files, since changes there are overwritten by upgrades. Done when the manager starts or reloads without errors in its logs.

  5. Deploy to the manager and reload

    Apply the change in a non-production or staging manager first where possible, then the production manager, following the restart method you confirmed. Watch the manager logs for rule loading errors and check that the rule count and IDs are visible through the Wazuh tooling your team uses. Done when the custom rules load on the manager with no parse errors and the decoder change is active.

  6. Generate live events and confirm the alert

    Trigger the real condition in a controlled way, such as failed logins from a test host, and confirm the events reach the manager through the agent or syslog path. Then open the Wazuh dashboard and search for the child rule ID to see the alert, its level, its source field and its grouping. Check that the base events appear as well, so analysts can trace the count back to individual logs. Done when the frequency alert appears once for the threshold crossing and its fields match the test.

  7. Review alert volume and tune thresholds

    Over a period of normal traffic, review how often the new rule fires and whether analysts can act on the alerts it creates. Adjust the frequency, timeframe or level only after recording the reason, and rerun the logtest replays after each change. Record the final rule and test set in version control so the detection can be reviewed and reproduced later. Done when alert volume is understood and the rule and its tests are stored together.

How a frequency rule evaluates incoming events

The evaluation starts when an agent sends a log line to the Wazuh server, where a decoder extracts fields and a base rule matches the event. Each match is counted against a frequency rule keyed by the same-field value, such as a source IP, inside the timeframe window. Only when the count reaches the configured threshold does the correlated alert fire; below it, the server keeps waiting. When checking a rule, confirm the base rule matches the events you expect and that the grouping field is present in every decoded event.

Path from a log event to a correlated alert, with the counter waiting below threshold.

Tuning thresholds for different sources and environments

Internet-facing SSH servers receive constant background scanning, so repeated authentication failures from unknown addresses are the normal state, not an anomaly. Choose the threshold from a baseline: export a few weeks of authentication failure logs from the affected hosts, count failures per source address in fixed windows, and look at the distribution before picking a number. The point where legitimate scanning separates from targeted guessing is what you want to find. Keep the timeframe short enough that a burst stands out, and confirm the result with logtest before deploying.

  • Build the baseline per host: Scanners behave differently against different exposed ports and hostnames, so measure each internet-facing group separately.
  • Key on the source address: Use the source IP as the same-field so each attacker is counted on its own, not the host.
  • Separate success from failure: Alert on the failure rule, then use a second rule to flag a success from an address that had a burst of failures.
  • Expect scanner volume: Confirm with your own baseline whether a high failure count per hour is routine for your exposure before raising severity.
  • Review the threshold after exposure changes: Adding a new public service or moving a port changes the background noise.

Check the baseline against a week of recent logs and confirm the chosen values with the wazuh-logtest session before you deploy.

Security and operational risks of correlation rules

Frequency and timeframe rules are only as useful as their thresholds, their inputs and the people who maintain them. The cards below cover the ways these rules fail quietly, from attackers who stay under the threshold to content changes that nobody reviews, and the controls that catch each failure.

Attackers staying under the threshold

A rule that counts failed logins from one source within a set window only fires when the count crosses its threshold. An attacker who spreads attempts across many sources, or who slows down to fewer attempts per window, can stay below it. Check the threshold against your normal failure rates per source, and pair the rule with a broader rule keyed on the target account rather than only the source address.

Wazuh docs

Memory and indexing load from broad matches

A frequency rule that matches a common event across every agent can hold many events in memory while it counts. Broad matches also add load to the indexer when the resulting alerts are stored. Ask which events the rule matches on a busy day, scope it with agent groups or specific decoded fields, and watch server resource use after each new rule is deployed.

Rules that stop after decoder changes

Frequency rules depend on the fields that decoders extract, such as a source address or user name. If a decoder update renames or drops one of those fields, the rule keeps loading without errors and simply never fires. Keep sample log lines for each correlation rule and run them through wazuh-logtest after every decoder change, so a silent break shows up before production.

Alert fatigue from low thresholds

A threshold set too low turns a correlation rule into a constant source of alerts, and analysts learn to ignore it. Review how often each rule fires, which agents and sources drive the count, and whether the alerts led to action. Tune the level and threshold with that data, and document the reason for each change so the next reviewer knows why the number was chosen.

Rule IDs colliding with upgrades

Custom rules need IDs that do not overlap with the IDs shipped in default rule files. A collision can overwrite or hide a rule, and an upgrade can change default rules that your custom rules depend on. After every upgrade, review your custom rule files against the new defaults, confirm the IDs you use are still free, and rerun your logtest samples.

Wazuh release notes

Unreviewed changes to detection content

Anyone who can edit rule or decoder files on the Wazuh server can change what the platform detects, including turning off an alert that matters. Limit write access to the server and the configuration management path, store detection content in version control with reviewed merges, and require a logtest regression run before a change reaches production.

Questions teams ask before writing frequency rules

How much effort does a frequency rule set take to build?

Effort depends mostly on how many log sources and event types the rules cover, how well those logs already decode, and how many detections the team needs to tune. A single frequency rule for one repeated event, such as failed logins from one source, is a small task once the decoder works. A set covering several services, each with its own noise pattern, takes much longer because every rule needs sample events, a threshold decision and a test. Ask any partner to break the work down by log source and by rule, and to state what is one-time build work and what is ongoing tuning.

Can our internal team write frequency rules without outside help?

Yes, if the team already knows Wazuh rule syntax, can read decoded fields and has access to a test environment. The main gaps are usually not the XML but the judgment: picking a threshold that separates attacks from normal user behavior, and choosing the same-field keys that keep the count meaningful. Teams new to Wazuh often benefit from an outside review of the first few rules, then take over the rest. Be honest with yourselves about who will own the rules after the first release.

What does the work need from our team?

Plan to provide sample logs from each source you want to monitor, including both normal and failed or suspicious events, and a clear picture of what a real incident looks like in your environment. You also need a named owner who can approve thresholds, review alert volume and decide when a rule is too noisy. Access to the Wazuh server or a test copy, and to the agents or log sources that produce the events, is required before any rule can be checked against real data.

How long does testing take, and does log history change it?

Testing time depends on how much log history you can replay and how varied it is. With a short history, you can confirm that a rule fires on the events you expect, but you cannot yet judge how often it will fire on normal traffic. With weeks of history from the same sources, the team can measure the typical count per source and set thresholds with evidence instead of guesses. Ask whether the plan includes a period of live testing at a lower alert level before rules become active.

What drives the cost of a frequency rule project?

Cost follows the same drivers as effort: the number of log sources, the variety of formats that need custom decoders, the number of rules, and how much tuning the environment needs. Ongoing costs include reviewing alert volume after upgrades and when new applications are onboarded. Wazuh itself carries no license fee for the self-hosted software, so the spend is on staff time, outside services and infrastructure. Request a quote that lists each rule group, the testing approach and any recurring review work separately.

What would a partner scope before writing the rules?

A partner would start by confirming which log sources and events matter, what decodes correctly today, and which detections your security team needs. The written scope would list each rule group, the sample data used for testing, the test method, the tuning review period and the handover format. It should also state what the partner will not cover, such as fixing the upstream log source or changing your incident response process. Use that scope as the basis for comparing quotes.

Will frequency rules create a risk of missed detections?

A threshold that is set too high will miss slow or spread-out attacks, and one set too low will flood analysts with alerts. The risk is manageable when rules are tested against logs that include known attack patterns and normal peaks, and when the owner reviews results after the first weeks of live data. Document the reason for each threshold and timeframe, so the next reviewer can see what the rule was designed to catch.

Where to read the authoritative syntax

Check the rule syntax against the Wazuh documentation for the exact release you run, not against examples copied from forums, blog posts or older guides. The frequency, timeframe and same-field options described here are the ones to confirm first, because the attributes a rule accepts and how the server evaluates them are set by the release, and the official ruleset reference is the document that defines them. Start with the ruleset and rule syntax pages in the current Wazuh documentation, then read the attribute descriptions for frequency, timeframe and same_source_ip side by side with the example rule you plan to adapt.

Rule behavior changes between releases, so record the exact server version before you copy any pattern into production. The current release line is 4.14, and the most recent patch supplied for this topic is 4.14.9, released on 14 October 2026. Patch releases in the 4.14 line have arrived roughly every one to two months, so a version you tested last quarter may already be behind. Compare your running version with the Wazuh release notes before you change detection logic, and read any entries that mention rules, decoders or the analysis engine for the versions between your build and the target.

Confirm two things with your own environment before you rely on a correlation rule: the version on every Wazuh server node in a cluster, and the version your test environment runs. A rule that counts failures correctly in one build can behave differently in another, so the test that matters is a replay of sample events on the same version you will deploy. Keep the version and the date you verified each rule next to the rule file in your repository, so that an upgrade review knows which detections need retesting.

How DeployOpen scopes and delivers Wazuh detection content

DeployOpen plans, implements, tests, documents and supports self-hosted open-source platforms inside the client's own infrastructure, and that includes Wazuh detection content. For correlation rules with frequency and timeframe, we agree the event pattern, thresholds and alert handling in writing, build the rules in your environment, and hand over tested content your team can maintain.

How we scope

  • Agree in writing which log sources, decoded fields and event patterns the frequency rules will cover
  • Record the threshold, timeframe and same-field logic each rule needs, with the expected alert level
  • Confirm which Wazuh version and deployment method your environment runs before any rule is written
  • Engagements are fixed-scope, with deliverables and timelines agreed before work starts

How we build

  • Write rule files with ID ranges that sit outside Wazuh default rules, so upgrades do not overwrite your content
  • Use frequency, timeframe and same-field options, and check each threshold against sample logs in wazuh-logtest
  • Test benign bursts and sustained attacks separately, so both the trigger and the quiet period are verified
  • Tag rules with descriptions and groups that analysts can act on during triage

How we hand over

  • Deliver rule and decoder files with version control notes, test log samples and expected rule outcomes
  • Document each threshold, its reasoning and the alert volume you should expect after deployment
  • Walk your security and operations staff through how to change a threshold and retest it safely
  • Provide a retest record showing which rules fired on which samples before and after handover

How we support

  • Offer ongoing support and upgrades as a retainer, including review of frequency rules after each Wazuh patch release
  • Re-run the test samples when Wazuh changes decoders or rule behavior, and report what needs adjusting
  • Adjust thresholds when alert volume or attack patterns in your environment change, with changes documented
  • Confirm with your team which support scope, response expectations and review cadence fit your operations

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.