Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new custom field to the vulnerability detector index #141

Merged
merged 3 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# build files
artifacts/

.java
.m2

# intellij files
.idea/
*.iml
Expand Down
1 change: 1 addition & 0 deletions ecs/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ generate_mappings() {
--subset "$IN_FILES_DIR/subset.yml" \
--template-settings "$IN_FILES_DIR/template-settings.json" \
--template-settings-legacy "$IN_FILES_DIR/template-settings-legacy.json" \
--mapping-settings "$IN_FILES_DIR/mapping-settings.json" \
--out "$OUT_DIR" || exit 1

# Replace "match_only_text" type (not supported by OpenSearch) with "text"
Expand Down
7 changes: 4 additions & 3 deletions ecs/vulnerability-detector/event-generator/event_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,16 @@ def generate_random_vulnerability():
'temporal': round(random.uniform(0, 10), 1),
'version': round(random.uniform(0, 10), 1)
},
'severity': random.choice(['low', 'medium', 'high', 'critical'])
'severity': random.choice(['Low', 'Medium', 'High', 'Critical'])
}
return vulnerability


def generate_random_wazuh():
wazuh = {
'cluster': {
'name': f'wazuh-cluster-{random.randint(0,10)}'
'name': f'wazuh-cluster-{random.randint(0,10)}',
'node': f'wazuh-cluster-node-{random.randint(0,10)}'
}
}
return wazuh
Expand All @@ -186,7 +187,7 @@ def generate_random_data(number):
'ecs': {'version': '1.7.0'},
# 'event': generate_random_event(),
'host': generate_random_host(),
'labels': generate_random_labels(),
# 'labels': generate_random_labels(),
'message': f'message{random.randint(0, 99999)}',
'package': generate_random_package(),
'tags': generate_random_tags(),
Expand Down
7 changes: 6 additions & 1 deletion ecs/vulnerability-detector/fields/custom/wazuh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@
type: keyword
level: custom
description: >
Wazuh cluster name.
Wazuh cluster name.
- name: cluster.node
type: keyword
level: custom
description: >
Wazuh cluster node name.
4 changes: 4 additions & 0 deletions ecs/vulnerability-detector/fields/mapping-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"dynamic": "strict",
"date_detection": false
}
5 changes: 4 additions & 1 deletion ecs/vulnerability-detector/fields/subset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
name: vulnerability_detector
fields:
base:
fields: "*"
fields:
"@timestamp": {}
tags: []
message: ""
agent:
fields: "*"
ecs:
Expand Down