Csv output plugin - custom field

I'm following Csv output plugin | Logstash Reference [6.1] | Elastic and I have a question...

How would I add extra field with my own text?

Please advise.

hi @alexus,

https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-add_field

https://www.elastic.co/guide/en/logstash/current/plugins-filters-kv.html

You can use mutate or kv plugin in filter to add field.

Thanks & Regard,
Krunal.

I've tried adding following:

    filter {
      mutate {
        add_field => { "key" => "value" }
      }
    }

yet file came out without new column "key" with "value" in every row...

i have been try this to add extra field and its working fine:

filter
{
mutate
{
add_field => ["Local_ip", "%{[Local][2]}"]
}
}

hmm, your example looks similar to mine, except for in mine (per Logstash's reference example), I used curly brackets and you use square brackets...

Did you had to adjust output somehow to reflect new field in output file somehow? maybe that's the part I'm missing somehow?

ahh, I was right... I added in output csv fields added my new field and now it's working as expected)

Great :slight_smile:

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