Rolling Logs in Logstash?


#1

Every time there's an event in Logstash, I ensure that it's logged in a log file. But the problem is that .. the log file keeps growing every day. I need to segregrate logs by the day so I could delete old logs as per my convenience. So, my question is .. Can we have rolling logs for Logstash?


(Magnus B├Ąck) #2

How are you logging the messages, via a file output or a stdout output? In the latter case I think external rotation already works (i.e. use logrotate or a similar tool) but the file output doesn't support external renames. See the issue below.

Keep in mind that the plugin's path option supports sprintf formatted strings so you could use e.g. /path/to/logfile.%{+YYYY.MM.DD}.log as the output file's path to have it write events to files named after the @timestamp field.


(system) #3