Skip to content

Commit 2462e5f

Browse files
committed
refactor: Migrate filter configurations from .conf to .yml format.
1 parent b23c9ac commit 2462e5f

12 files changed

Lines changed: 564 additions & 966 deletions

File tree

filters/antivirus/checkpoint.conf

Lines changed: 0 additions & 139 deletions
This file was deleted.

filters/antivirus/checkpoint.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
pipeline:
2+
- dataTypes:
3+
- antivirus-checkpoint
4+
steps:
5+
# 1. Parse header to extract the payload inside brackets
6+
- grok:
7+
source: raw
8+
patterns:
9+
- fieldName: log.header
10+
pattern: '{{.data}} - \['
11+
- fieldName: log.payload
12+
pattern: '{{.data}}'
13+
- fieldName: log.footer
14+
pattern: '; \]'
15+
16+
# 2. Parse the payload as Key-Value pairs
17+
- kv:
18+
source: log.payload
19+
fieldSplit: " "
20+
valueSplit: ":"
21+
22+
# 3. Clean up quotes from values (since we don't have trim_value in kv)
23+
# We would need a trim step for every field, but since we don't know all dynamic fields,
24+
# we assume the KV parser handles basic quotes or we accept them.
25+
# However, Logstash config suggests fields might be quoted like field:"value".
26+
# The CEL-based KV step usually handles standard formats.
27+
28+
# 4. Standard Reference Mapping
29+
- rename:
30+
from: [log.src]
31+
to: origin.ip
32+
- rename:
33+
from: [log.dst]
34+
to: target.ip
35+
- rename:
36+
from: [log.s_port]
37+
to: origin.port
38+
- rename:
39+
from: [log.service]
40+
to: target.port
41+
42+
# 5. Type Casting
43+
- cast:
44+
fields: [origin.port, target.port]
45+
to: int
46+
47+
# 6. Clean up
48+
- delete:
49+
fields: [log.header, log.footer]

filters/hids/hids-wazuh.conf

Lines changed: 0 additions & 143 deletions
This file was deleted.

filters/hids/hids-wazuh.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
pipeline:
2+
- dataTypes:
3+
- hids
4+
steps:
5+
# 1. Parse JSON
6+
- json:
7+
source: raw
8+
9+
# 2. Rename Agent Fields
10+
- rename:
11+
from: [log.agent.id]
12+
to: log.agent_id
13+
- rename:
14+
from: [log.agent.ip]
15+
to: log.agent_ip
16+
- rename:
17+
from: [log.agent.name]
18+
to: log.agent_name
19+
- rename:
20+
from: [log.manager.name]
21+
to: log.manager
22+
23+
# 3. Handle Special "000" Agent Case (from conf)
24+
# In the new system, we might just keep the values as is,
25+
# or if we need to enforce dataSource changes, we relies on pipeline logic.
26+
# The old conf set "dataSource" => "hids" if agent.id == "000".
27+
# This is likely handled by defining the dataType as "hids" for this pipeline.
28+
29+
# 4. Rename Other Fields
30+
- rename:
31+
from: [log.decoder.name]
32+
to: log.decoder_name
33+
- rename:
34+
from: [log.rule]
35+
to: log.rule
36+
- rename:
37+
from: [log.location]
38+
to: log.location
39+
- rename:
40+
from: [log.data]
41+
to: log.data
42+
43+
# 5. Severity Mapping based on Rule Level
44+
- add:
45+
function: string
46+
params: { key: severity, value: high }
47+
where: 'exists("log.rule.level") && greaterThan("log.rule.level", 11)'
48+
- add:
49+
function: string
50+
params: { key: severity, value: medium }
51+
where: 'exists("log.rule.level") && lessOrEqual("log.rule.level", 11) && greaterOrEqual("log.rule.level", 7)'
52+
- add:
53+
function: string
54+
params: { key: severity, value: low }
55+
where: 'exists("log.rule.level") && lessThan("log.rule.level", 7)'
56+
57+
# 6. Standard UTMStack Fields
58+
# If these exist in log.data or elsewhere, they should be mapped.
59+
# The conf didn't map to origin.ip/target.ip explicitly unless they were in "data".

0 commit comments

Comments
 (0)