Can I get only one data in logstash's output?

Can I get only one data in logstash's output?

If the data after filter like:

"a" => 1,
"b" => 2,
"c" => 3,

in the output, send it to elasticsearch.

output {
    elasticsearch {
        protocol => http
        host => "ES_NODE_HOST"
    }
}

I want to add another output but only get a:

output {
    elasticsearch { # It get a,b,c
        protocol => http
        host => "ES_NODE_HOST"
    }
    file {          # It get a
      path => ...
      codec => line { format => "custom format: %{message}"}
    }
}

Is it possible?

You could use pipeline to pipeline communications with the forked path pattern.

However, with an output configured with

codec => line { format => "custom format: %{message}"}

the output will not have the fields [a], [b], or [c], only [message]. If you just want field [a] you could use

codec => line { format => "custom format: %{a}"}

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.