Logstash output filename timezone problem


(for_logstash) #1

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!!!


(for_logstash) #2

I am new to logstash, who can help me?


(Daniel Walker) #3

ha, we are in the same situation here.


(Magnus Bäck) #4

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.


(Daniel Walker) #5

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


(Magnus Bäck) #6

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


(system) #7

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