-
-
Save sidkrishna/d7f117bb95f2aa34ec51aa52158a5dbf to your computer and use it in GitHub Desktop.
syslog_elk_stackstorm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter { | |
if [type] == "syslog" { | |
grok { | |
match => { "message" => "Interface %{GREEDYDATA:interfacename} is link down" } | |
add_field => [ "received_at", "%{@timestamp}"] | |
add_field => [ "received_from", "%{host}" ] | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
udp { | |
port => 514 | |
type => syslog | |
} | |
} | |
output { | |
elasticsearch { hosts => ["127.0.0.1:9200"] } | |
stdout { } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "elk_link_flap_webhook_rule" | |
enabled: true | |
description: "ELK link flap webhook rule" | |
trigger: | |
type: "core.st2.webhook" | |
parameters: | |
url: "elk_link_flap" | |
criteria: {} | |
action: | |
ref: st2_demos.link_flap_remed_workflow | |
parameters: | |
host: "{{trigger.body.host}}" | |
interface: "{{trigger.body.interface}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT _watcher/watch/my_demo_watch | |
{ | |
"trigger" : { | |
"schedule" : { "interval" : "5s" } | |
}, | |
"input" : { | |
"search": { | |
"request": { | |
"indices": "logstash-*", | |
"body": { | |
"query": { | |
"bool": { | |
"must": { | |
"match_phrase": { | |
"message": "is link down" | |
} | |
}, | |
"filter" : { | |
"range": { | |
"@timestamp": { | |
"from": "now-8s", | |
"to": "now" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"condition" : { | |
"compare" : { "ctx.payload.hits.total" : { "gt" : 0 }} | |
}, | |
"actions" : { | |
"my_webhook" : { | |
"webhook" : { | |
"scheme" : "https", | |
"port" : 443, | |
"method" : "POST", | |
"host" : "bwc", | |
"path" : "/api/v1/webhooks/elk_link_flap?st2-api-key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | |
"headers": { | |
"Content-Type": "application/json" | |
}, | |
"body" : "{\"host\": \"{{ctx.payload.hits.hits.0._source.host}}\", \"interface\": \"{{ctx.payload.hits.hits.0._source.interfacename}}\"}" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment