Logstash filter - get field?


(saye) #1

I've got log lines in the following format and want to extract fields:

{
"message" => "...",
"@version" => "1",
"@timestamp" => "2014-07-07T08:49:28.543Z",
"host" => "abc",
"field1" => "content1",
"field2" => "content2",
"field3" => "content3"
}
I neither know the field names, nor the number of fields.

i only want to get the "message"、"@version"、"@timestamp"、"host"、 "field1" and the content of these fields that i want , the output looks like as follows,

"message" => "...",
"@version" => "1",
"@timestamp" => "2014-07-07T08:49:28.543Z",
"host" => "abc",
"field1" => "content1"

Kindly help me to get required output.


(Mark Walkom) #2

Have you seen https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html?


(Magnus Bäck) #3

Did you look at the prune filter?


(saye) #4

i can get these field and content as follows,
"message" => "...",
"@version" => "1",
"@timestamp" => "2014-07-07T08:49:28.543Z",
"host" => "abc",

but I neither know the field1 names, nor the number of fields.
the field1 is just an example
i want to get the field that count from the message beginning of the number of sixth .


(Magnus Bäck) #5

So this is the exact same problem as in the other thread? Then I suggest we keep it in one thread and close this one.


(Mark Walkom) #6

Good point, let's keep it in here - How to remove dynamical field?


(Mark Walkom) #7