Last active
July 30, 2020 13:49
-
-
Save cyberbutler/20cfdd80233f0b8bd5568e4dea8eceb8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { | |
beats { | |
port => 5044 | |
} | |
} | |
filter { | |
if [infralogtype] == "bash" { | |
grok { | |
match => { "message" => "^%{SYSLOGTIMESTAMP:syslog_timestamp}\s%{HOSTNAME}\s.+?:\s(?<json_message>.*)$"} | |
add_field => [ "received_at", "%{@timestamp}" ] | |
} | |
date { | |
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ] | |
} | |
json { | |
source => "json_message" | |
} | |
ruby { | |
init => "require 'base64'" | |
code => 'event.set("[command]", event.get("b64_command") ? Base64.decode64(event.get("b64_command")) : nil)' | |
} | |
ruby { | |
init => "require 'base64'" | |
code => 'event.set("[output]", event.get("b64_output") ? Base64.decode64(event.get("b64_output")) : nil)' | |
} | |
} | |
} | |
output { | |
if [infralogtype] == "bash" { | |
elasticsearch{ | |
hosts => ["elasticsearch:9200"] | |
user => "elastic" | |
password => "changeme" | |
sniffing => true | |
index => "bash-%{+YYYY.MM.dd}" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment