File output plugin's file rotation based on size or say after every 4 hours


(Arvind Kumar) #1

I am using file output plugin to write the logs processed by Logstash to files which are rotated day-wise but I want rotation of the output files based on the file size or after every say 4 hours. How can I achieve this?


(Magnus B├Ąck) #2

You can use a ruby filter to create a field (as a subfield of @metadata if you don't want the field to be visible to the outputs) containing a value that you use in the path option of your file output. For example, to rotate logs every four hours you could take the current hour (in the range 0 to 23, obviously) and divide it with four to get an integer in the range 0 to 5.


(system) #3

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