update ingest pipeline for imported logs

Signed-off-by: reyesj2 <94730068+reyesj2@users.noreply.github.com>
This commit is contained in:
reyesj2
2025-01-16 17:33:14 -06:00
parent b3b7fb8f29
commit 45d3438d18
2 changed files with 18 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
{ {
"description" : "suricata.alert", "description" : "suricata.alert",
"processors" : [ "processors" : [
{ "set": { "field": "_index", "value": "logs-suricata.alerts-so" } }, { "set": { "if": "ctx.data_stream?.dataset != null && ctx.data_stream?.dataset == 'suricata'", "field": "_index", "value": "logs-suricata.alerts-so" } },
{ "set": { "field": "tags","value": "alert" }}, { "set": { "field": "tags","value": "alert" }},
{ "rename":{ "field": "message2.alert", "target_field": "rule", "ignore_failure": true } }, { "rename":{ "field": "message2.alert", "target_field": "rule", "ignore_failure": true } },
{ "rename":{ "field": "rule.signature", "target_field": "rule.name", "ignore_failure": true } }, { "rename":{ "field": "rule.signature", "target_field": "rule.name", "ignore_failure": true } },

View File

@@ -527,6 +527,10 @@ post_to_2.4.111() {
post_to_2.4.120() { post_to_2.4.120() {
update_elasticsearch_index_settings update_elasticsearch_index_settings
# Manually rollover suricata alerts index to ensure data_stream.dataset expected mapping is set to 'suricata'
rollover_index "logs-suricata.alerts-so"
POSTVERSION=2.4.120 POSTVERSION=2.4.120
} }
@@ -805,6 +809,19 @@ ASSIST_EOF
fi fi
} }
rollover_index() {
idx=$1
exists=$(curl -K /opt/so/conf/elasticsearch/curl.config -s -o /dev/null -w "%{http_code}" -k -L -H "Content-Type: application/json" "https://localhost:9200/$idx")
rollover=$(curl -K /opt/so/conf/elasticsearch/curl.config -s -o /dev/null -w "%{http_code}" -k -L -H "Content-Type: application/json" "https://localhost:9200/$idx/_rollover" -XPOST)
if [[ $rollover -eq 200 ]]; then
echo "Successfully triggered rollover for $idx..."
else
echo "Could not trigger rollover for $idx..."
fi
}
suricata_idstools_migration() { suricata_idstools_migration() {
#Backup the pillars for idstools #Backup the pillars for idstools
mkdir -p /nsm/backup/detections-migration/idstools mkdir -p /nsm/backup/detections-migration/idstools