Skip to content

Commit

Permalink
use so-elasticsearch-query where possible; simplify suricata.alerts i…
Browse files Browse the repository at this point in the history
…ndex reroute

Signed-off-by: reyesj2 <[email protected]>
  • Loading branch information
reyesj2 committed Jan 17, 2025
1 parent 01a2e4c commit 1396083
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion salt/elasticsearch/files/ingest/suricata.alert
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"description" : "suricata.alert",
"processors" : [
{ "set": { "if": "ctx.event?.imported != null && ctx.event?.imported != true", "field": "_index", "value": "logs-suricata.alerts-so" } },
{ "set": { "if": "ctx.event?.imported != true", "field": "_index", "value": "logs-suricata.alerts-so" } },
{ "set": { "field": "tags","value": "alert" }},
{ "rename":{ "field": "message2.alert", "target_field": "rule", "ignore_failure": true } },
{ "rename":{ "field": "rule.signature", "target_field": "rule.name", "ignore_failure": true } },
Expand Down
5 changes: 2 additions & 3 deletions salt/manager/tools/sbin/soup
Original file line number Diff line number Diff line change
Expand Up @@ -812,10 +812,9 @@ ASSIST_EOF

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")

exists=$(so-elasticsearch-query $idx -o /dev/null -w "%{http_code}")
if [[ $exists -eq 200 ]]; then
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)
rollover=$(so-elasticsearch-query $idx/_rollover -o /dev/null -w "%{http_code}" -XPOST)

if [[ $rollover -eq 200 ]]; then
echo "Successfully triggered rollover for $idx..."
Expand Down

0 comments on commit 1396083

Please sign in to comment.