Experimental

Download 503
Last updated Sep 3, 2026

sonar-replay-batch-rules

Replay batch rules over a past time range. Enumerates cron fire times of batch rules in the range. By default, outputs the replay plan only (dry run). With run=t, actually runs the rule query at each fire time and raises events and tickets. Constraints: requires administrator privilege, and run=t is rejected on standby nodes. Events are backdated to each fire time, but ticket created/updated times are the current time. Suppression windows are simulated within the replay only, independently of the live suppression state. Signature/ETIR risk scoring is not applied. now(), ago(), and duration= expressions in the rule query are rewritten to constants based on each fire time.

sonar-replay-batch-rules [from=VALUE] [to=VALUE] [duration=VALUE] [guids=VALUE] [run=VALUE] [limit=VALUE]
from=VALUE
Optional. Replay range start time (yyyyMMddHHmmss). Specify from or duration.
to=VALUE
Optional. Replay range end time (yyyyMMddHHmmss, default: now). A future time is truncated to now. The range is limited to 366 days.
duration=VALUE
Optional. Replay range from now (e.g. 7d). Specify from or duration.
guids=VALUE
Optional. Comma-separated batch rule GUIDs (default: all enabled batch rules)
run=VALUE
Optional. Set t to actually run rule queries and raise events and tickets (default: f, dry run). Events are backdated to each fire time, and suppression windows are simulated at fire times. Note that replayed tickets are created for real.
limit=VALUE
Optional. Maximum count of (rule, fire time) pairs (default: 10000)

Output Fields

FieldTypeNameDescription
rule_idIntegerRule IDe.g. 1
rule_guidStringRule GUIDe.g. 550e8400-e29b-41d4-a716-446655440000
rule_nameStringRule namee.g. Failed login detection
enabledBooleanEnablede.g. true
scheduleStringCron schedulee.g. */5 * * * *
fire_timeDateFire timee.g. 2026-09-01 00:05:00
query_fromDateQuery from constante.g. 2026-09-01 00:00:00, null if rule duration is not set
query_toDateQuery to constante.g. 2026-09-01 00:05:00
durationIntegerRule duration in secondse.g. 300
datetruncIntegerRule date truncation in secondse.g. 60
dataset_guidStringDataset GUIDe.g. 550e8400-e29b-41d4-a716-446655440000, null if the rule query is inlined
queryStringReplay query stringFinal query to run, with the sort clause appended. now() and ago() calls are replaced with constants.
constantsMapInjected constantse.g. {NOW=2026-09-01 00:05:00}. Query context constants injected on replay.
rewrite_warningsListRewrite warningse.g. [ago() with non-literal argument, not replaced]
suppress_keyStringSuppress keye.g. account
statusStringReplay statuse.g. success. One of success, error, or cancelled. run=t only.
result_countLongQuery result counte.g. 10. run=t only.
alert_countIntegerAlert counte.g. 3. Count of unique suppress keys merged into alerts. run=t only.
ticket_countIntegerTicket counte.g. 3. Count of distinct tickets related to responded alerts. Depending on the rule ticket issuance condition, a responded alert may not issue a ticket, and a suppressed merge updates an existing ticket instead of creating one. run=t only.
raw_countIntegerRaw event counte.g. 10. Count of rows written to the raw event table. run=t only.
suppressed_countIntegerSuppressed row counte.g. 2. Count of rows skipped by event suppression. run=t only.
elapsed_msLongElapsed millisecondse.g. 1234. run=t only.
ticket_guidsListTicket GUIDse.g. [550e8400-e29b-41d4-a716-446655440000]. Distinct ticket GUIDs related to responded alerts. run=t only.
_errorStringError messagee.g. dataset not found. Null unless the replay item failed.