[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Rotating logs (and keeping the log's tail)



Frank Lin PIAT wrote:
Hello,

I use a wiki engine that produces an event log, which I want to rotate.

Because the event-log is used to display the "PageHits", I don't want to
truncate the log every Monday. I wish the log could contain the last
week, plus the current week, so the statistics are never empty.

The scenario would be:

On The 2nd Monday: store the last line of the log (i.e "tag" it)

On the next Mondays: * Save the top of the file (above the tag)
 * Delete the top of the current log.
 * Update the tag (to the bottom of the log file).
Can't you just write a script that updates the tag to a separate file, and use logrotate to do the normal logrotation? So something like
'cat /var/log/wiki.log | grep tag > /var/log/tag.log'
and in /etc/logrotate.d/ you create a rule for wiki.log (or whatever the log files are named.
Or did I just not understand what you want?

Sjoerd

Franklin

[Please CC me, I am not subscribed to this list]

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: