Skip to content

Instantly share code, notes, and snippets.

@cyberbutler
Last active July 30, 2020 13:49
Show Gist options
  • Save cyberbutler/20cfdd80233f0b8bd5568e4dea8eceb8 to your computer and use it in GitHub Desktop.
Save cyberbutler/20cfdd80233f0b8bd5568e4dea8eceb8 to your computer and use it in GitHub Desktop.
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