I would like to delete following files with newsyslog.conf when the files are older than 6 month:
# logfile [owner:group] mode count size when flags [/pid_file] /mnt/usb/access_*.log
Which other options do I have to set?
You need to specify values for all of the mandatory fields.
The following will cause new log files to be created with mode 644, and will keep at most 6 files, before deleting the oldest. The
* in the
size field tells
newsyslog not to consider the size of the file when running.
$M1D0 means "rotate the file once a month, on the first day of the month, at midnight".
newsyslog that the filename is a shell pattern and that it should rotate all files that match (
G), that it should compress the rotated file with
J), and that it does not need to send a signal to a daemon process (
# logfile [owner:group] mode count size when flags /mnt/usb/access_*.log 644 6 * $M1D0 GJN
Without knowing more about your use case, it's impossible to give you a more specific instruction. For example, you say nothing about how these files are written, or what ownership should apply, but the
newsyslog.conf manpage is pretty detailed, and should help you fill in the blanks.