Logstash output filename timezone problem

Hi

I want to output the file using current time just like the config below.
output {
file {
path =>"/home/test/%{+YYYYMMdd}/nginx_%{+YYYYMMdd_HH}.log"
}
}

the filename generated use the UTC timezone time, But I want to ouput the filename with my local time zone(Asia/Beijing)
e.g my local current time is "2016-12-23 17:44"

run the config file above, the filename is "nginx_20161223_09.log"

how can I get the filename using my timezone,just like this "nginx_20161223_17.log"???

Thanks!!!

1 Like

I am new to logstash, who can help me?

ha, we are in the same situation here.

UTC is used and this isn't configurable. What you can do (although I think it's a mistake) is to use a ruby filter to create a @metadata field containing the date you want and then reference that field in the file output's path configuration.

Sorry, but could you please show us the code snippet?

I'm afraid I don't have a code snippet handy. What part are you having trouble with?

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