How to set locale for add_field inside a date filter?


(Flávio Knob) #1

Hi,

I'm trying to create a new field with the weekday based on the @timestamp field, which I generate with a date {} filter. The date {} seems to be working just fine, putting the correct value in the @timestamp. But the thing I'm not figuring out how to do is to generate the "weekday" field in the locale I've specified. The field is being created, but the value is generated using the locale of the host machine (which is in German) and not in Portuguese (my goal).

Is the "locale" parameter only for the "matching" part of the date {}?

Thank you!

Code here ("dia_semana" == "weekday"):

date {
    locale => "pt-BR"
    match => [ "data", "dd/MM/yyyy" ]
    target => "@timestamp"

    add_field => { "dia_semana" => "%{+EEEEE}" }  
}

(Magnus Bäck) #2

Is the "locale" parameter only for the "matching" part of the date {}?

Yes, I think that's safe to assume. The add_field functionality is generic for all filters.


(system) #3

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