renaming a syslog log file in the current date format

AFAIK neither syslog nor newsyslog is able to do that. You will need to create a script that does this.
 
plz explain how to do that.
just renaming the file which is currently in use by syslogd will be ok so that it stops writing to it ?
 
I don't think that either syslog nor syslog-ng, nor newsyslog, nor logrotate, handle renaming or creating logfiles with timestamps or something like that. An option would be to tell newsyslog to rotate every single logfile at midnight, and then have a local script rename every *.0.bz2 (or *.0.gz) to *.`date -v-1d +%Y%m%d`.bz2 (or .gz, whatever). This does cause a lot of clutter in /var/log, so you might want to move things out of the way to /var/log/month/ or /var/log/week.
 
Thanks for the solution.
i think i found another solution to this. i read on syslog-ng and i found the following in its configuration file

destination d_fancy_file { file("/var/log/$YEAR/$MONTH/$DAY/$FACILITY.$PRIORITY.log" \
owner(root) group(root) perm(0600) dir_perm(0700) create_dirs(yes)); };


which places the log in a different folder.
 
Back
Top