Console Filter
The console filter suppresses known noisy console lines so important logs remain visible. Lines that match a rule are dropped before they reach the engine logger, so they never show up in the console or in the log files.
Config File
Edit the following file:
addons/swiftlys2/configs/confilter.jsonc
If the file does not exist yet, SwiftlyS2 creates it on startup from addons/swiftlys2/configs/confilter.example.jsonc, which ships with the default rules. Every *.example.jsonc in the configs directory is copied without the .example part when the matching file is missing, so deleting confilter.jsonc restores the default rules on the next start. Change the location with -sw_path if SwiftlyS2 is installed elsewhere - see CLI Options.
File Format
The file is a single JSONC object where each entry defines one filter rule:
{
"Tick_number": "empty starved x", // rule name -> PCRE2 pattern
"Ticks": "ticks this frame",
/* multi-line comments work as well */
"Framerate_Values": "\\d+\\.\\d+ms\\s+\\d+\\.\\d+%\\s+\\d+\\.\\d+ms\\s+[A-Za-z\\s]+"
}- Key: rule name used to identify the rule in
sw confilter statusand in error messages. Rule names are otherwise free-form and have to be unique. - Value: PCRE2 pattern matched against the console line. Values have to be JSON strings, so a backslash is escaped as
\\-"\\d+"in the file is the pattern\d+.
Both // and /* */ comments are stripped before the file is parsed. The root has to be a flat object of string values - nested objects, arrays and trailing commas are not supported.
The shipped confilter.example.jsonc contains the default rules:
{
"BotProfile": "botprofile",
"Unexpected": "UNEXPECTED LONG",
"IgnoreBad": "Ignored bad",
"Tick_number": "empty starved x",
"Ticks": "ticks this frame",
"long_frame": "Long frame",
"Model": "name collision found",
"Certificate": "Certificate expires in",
"RemoveArray": "RemoveArrayElementsOutsideOfArrayMetadataBounds",
"CreatingNetChan": "Creating NetChan",
"StartingFreezeperiod": "Starting Freeze period",
"JsonBegin": "JSON_BEGIN",
"discarding_suspicious": "which is suspicious, discarding",
"BacktrackPlayer": "No valid positions in history for BacktrackPlayer",
"killed_other": "killed other",
"disconnects_timeouts": "reply timeouts",
"name": "round_stats",
"round_number": "round_number",
"score_t": "score_t",
"score_ct": "score_ct",
"players_0": "players_0",
"MatchStatus": "MatchStatus",
"blinded": "blinded for",
"player_0": "player_0",
"json_end": "JSON_END",
"roundstart": "World triggered Round_Start",
"teamct": "Team CT triggered",
"teamt": "Team T triggered",
"teamtero": "Team TERRORIST",
"teamtcounter": "Team CT",
"roundend": "World triggered Round_End",
"laterecv": "LATE Recv",
"generatesubstitute": "generating substitute",
"texturebase": "texturebase.cpp",
"CNavMesh": "CNavMesh::TestRayToMesh",
"CRecipientFilter": "CRecipientFilter::AddAllPlayers",
"CNavGenParams": "CNavGenParams -",
"Framerate_Title": "Framerate spike report",
"Framerate_Spacer": "-+\\s+-+\\s+-+\\s+-+",
"Framerate_Header": "excl ms excl % incl ms group",
"Framerate_Values": "\\d+\\.\\d+ms\\s+\\d+\\.\\d+%\\s+\\d+\\.\\d+ms\\s+[A-Za-z\\s]+",
"Framerate_Total": "FrameTotal:\\s+\\d+\\.\\d+ms,\\s+\\s*tolerance:\\s+\\d+\\.\\d+ms",
"IGameSystem": "IGameSystem::",
"FLASHBANG": "FLASHBANG:"
}How It Works
- Every value is compiled once as a PCRE2 regular expression when the file is loaded, and JIT-compiled.
- Patterns are unanchored and case-sensitive, so they match anywhere in the line - use
^/$when the pattern must match the whole line and(?i)for case-insensitive matching. - Rules are evaluated in alphabetical order of the rule name, not in the order they appear in the file. A line is dropped as soon as a rule matches it and that rule's counter is incremented, so a line matching several rules counts towards the rule whose name sorts first.
- If a regular expression fails to compile, the error is logged with the rule name and the failing offset, and only that rule is skipped.
- Rules named
Framerate_ValuesandFramerate_Totalare handled specially: the next line that contains nothing but a newline is dropped as well, keeping the framerate report grouped. - Rule names are only labels for
sw confilter statusand for error messages. - If the file is missing or not valid JSON, no rule is loaded and nothing is filtered; none of these cases is logged, so check the file syntax first when filtering stops working.
Enabling and Disabling
ConsoleFilter in core.jsonc (default true) decides whether filtering is active after startup - see Core Configuration. The enable/disable subcommands below toggle the same state at runtime, but that change is not persisted, so the value from core.jsonc applies again after a restart. While filtering is disabled no rule is evaluated, so the counters stay unchanged.
Command Management
sw confilter is restricted to the server console; sw help lists it as Console Filter Menu. Run it without a subcommand to print the subcommand list; an unrecognized subcommand prints Unknown command.
| Subcommand | Description |
|---|---|
enable | Enable console filtering. |
disable | Disable console filtering. |
status | Show the status of the console filter. |
reload | Reload console filter configuration. |
status prints the current state followed by one counter line per rule, including rules that never matched:
Console filtering is currently enabled.
Below are some statistics for the filtering process:
- BotProfile -> 0
- Tick_number -> 42
Counters are reset by reload, which also recompiles every pattern; it does not change whether filtering is enabled.
Plugins reach the same state through APIIConsoleOutputService - IsFilterEnabled, ToggleFilter, ReloadFilterConfiguration, NeedsFiltering and GetCounterText.
Typical Workflow
- Update
confilter.jsoncwith the rules you want. - Run
sw confilter reloadto apply configuration changes. - Use
sw confilter statusto confirm filtering is active and to see which rules match most.