Skip to content

Instantly share code, notes, and snippets.

@dongyi
Created August 22, 2019 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dongyi/ab645e942d3c28f9c7df0823c510a65e to your computer and use it in GitHub Desktop.
Save dongyi/ab645e942d3c28f9c7df0823c510a65e to your computer and use it in GitHub Desktop.
input {
tcp {
port => 5000
}
}
## Add your filters / logstash plugins configuration here
filter {
kv {
source => "message"
field_split => "[,\s]"
value_split => ":"
}
ruby {
code => "
hash = event.to_hash
hash.each { |key,value|
event.set(key.gsub('kv.', '').gsub('\"', ''), value)
}
"
}
}
output {
elasticsearch {
hosts => "elasticsearch:9200"
user => "elastic"
password => "changeme"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment