Skip to content

Instantly share code, notes, and snippets.

@igorwwwwwwwwwwwwwwwwwwww
Created August 3, 2015 10:29
Show Gist options
  • Save igorwwwwwwwwwwwwwwwwwwww/bf46534dedc0b72ac663 to your computer and use it in GitHub Desktop.
Save igorwwwwwwwwwwwwwwwwwwww/bf46534dedc0b72ac663 to your computer and use it in GitHub Desktop.
hello  {"foo":"bar"}
{
"message" => "hello \\xC2 {\\\"foo\\\":\\\"bar\\\"}",
"@version" => "1",
"@timestamp" => "2015-08-03T10:26:07.100Z",
"host" => "igor-rg.local",
"jsoninsides" => "{ \\\"foo\\\":\\\"bar\\\" }"
}
hello {"foo":"bar"}
{
"message" => "hello {\"foo\":\"bar\"}",
"@version" => "1",
"@timestamp" => "2015-08-03T10:26:20.266Z",
"host" => "igor-rg.local",
"jsoninsides" => "{ \"foo\":\"bar\" }"
}
cat broken.json | logstash -f testconf.conf --debug
cat fixed.json | logstash -f testconf.conf --debug
input {
stdin {
}
}
filter{
grok {
match => ["message", "^.*?\{%{GREEDYDATA:jsoninsides}\}"]
}
mutate {
replace => [ "jsoninsides", "{ %{jsoninsides} }" ]
}
}
output {
stdout { codec => rubydebug }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment