Skip to content

Instantly share code, notes, and snippets.

@devlatte
Last active April 28, 2017 08:10
Show Gist options
  • Save devlatte/051f435b885e59102a559e6662bf17e2 to your computer and use it in GitHub Desktop.
Save devlatte/051f435b885e59102a559e6662bf17e2 to your computer and use it in GitHub Desktop.
logstash rename json empty key field using ruby filter
filter{
ruby {
code => "h = event.get('[record][param]').to_hash; if h.has_key?('') then h['_LS_EMPTY_KEY']=h['']; h.delete(''); event.set('[record][param]', h) end"
}
}
# rename empty key field using ruby filter
# solution for error msg "name cannot be empty string" in elasticsearch output plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment