does remove_if_older still work?
I have one line in my syslog-ng.conf file, as follows: destination netops { file("/var/log/HOSTS/$HOST" remove_if_older(604800) owner(root) group (root) perm(0644) dir_perm(0700)); }; I'm running version 1.6.7 on Fedora Core 2. I would like to have the files that hit this destination be deleted every 7 days. It does not appear to be working as the files keep growing. Maybe I misunderstood, but this should let the file grow for n seconds, then delete the file and start writing to a new file with the same name, right? I tried setting this to 60 and that made no difference. Any help would be appreciated. Thanks, Chris
Only if the file is reopened, e.g. it has not been written within time_reap() seconds. On Mon, 2005-06-13 at 12:04 -0500, sawall wrote:
I have one line in my syslog-ng.conf file, as follows:
destination netops { file("/var/log/HOSTS/$HOST" remove_if_older(604800) owner(root) group (root) perm(0644) dir_perm(0700)); };
I'm running version 1.6.7 on Fedora Core 2. I would like to have the files that hit this destination be deleted every 7 days. It does not appear to be working as the files keep growing.
Maybe I misunderstood, but this should let the file grow for n seconds, then delete the file and start writing to a new file with the same name, right?
I tried setting this to 60 and that made no difference.
-- Bazsi
so, is there another way to do this, or is my best bet to do the following via cron: find /pathto/logs/* -ctime +7 -exec rm -f {} \; 2> /dev/null thanks, chris On 6/13/05, Balazs Scheidler <bazsi@balabit.hu> wrote:
Only if the file is reopened, e.g. it has not been written within time_reap() seconds.
On Mon, 2005-06-13 at 12:04 -0500, sawall wrote:
I have one line in my syslog-ng.conf file, as follows:
destination netops { file("/var/log/HOSTS/$HOST" remove_if_older(604800) owner(root) group (root) perm(0644) dir_perm(0700)); };
I'm running version 1.6.7 on Fedora Core 2. I would like to have the files that hit this destination be deleted every 7 days. It does not appear to be working as the files keep growing.
Maybe I misunderstood, but this should let the file grow for n seconds, then delete the file and start writing to a new file with the same name, right?
I tried setting this to 60 and that made no difference.
-- Bazsi
I have syslog-ng setup to add hostname dynamically. When a new server is pointed to the central log server it creates a /var/log/syslogs/$hostname dir and all logs from that host are put in there. in /etc/log/rotate.g/syslog-ng I have tried putting in /var/log/syslogs/* and this will not work. Is there a way for logrotate to search directories recursively? Or is there a way I can setup a script to interact with logrotate that will place a new entry for logs in the logrotate.d/syslog-ng file based on hostname directories created in /var/log/syslogs/
after scouring the net i don't see a light at the end of this tunnel so i went an alternate route and just edited the syslog-ng.conf from $HOST/$FACILITY to $HOST.$FACILITY and will be using /var/log/syslogs/* in logrotate.d/syslog-ng its working fine now. ;) Ken Garland wrote:
I have syslog-ng setup to add hostname dynamically. When a new server is pointed to the central log server it creates a /var/log/syslogs/$hostname dir and all logs from that host are put in there. in /etc/log/rotate.g/syslog-ng I have tried putting in /var/log/syslogs/* and this will not work.
Is there a way for logrotate to search directories recursively?
Or is there a way I can setup a script to interact with logrotate that will place a new entry for logs in the logrotate.d/syslog-ng file based on hostname directories created in /var/log/syslogs/
_______________________________________________ syslog-ng maillist - syslog-ng@lists.balabit.hu https://lists.balabit.hu/mailman/listinfo/syslog-ng Frequently asked questions at http://www.campin.net/syslog-ng/faq.html
On Mon, 13 Jun 2005 14:38:08 EDT, Ken Garland said:
I have syslog-ng setup to add hostname dynamically. When a new server is pointed to the central log server it creates a /var/log/syslogs/$hostname dir and all logs from that host are put in there. in /etc/log/rotate.g/syslog-ng I have tried putting in /var/log/syslogs/* and this will not work.
Is there a way for logrotate to search directories recursively?
Think outside the box. ;) /var/log/syslogs/$hostname/$day will automagically start a new log each day. Then 'find /var/log/syslogs -type f -mtime +31 -exec rm {} \;' for the cleanup. ;)
heh, i just emailed the group with another solution i came up with. i did not really want to go outside the logrotate.d/syslog-ng config and add more scripts to the server. Valdis.Kletnieks@vt.edu wrote:
On Mon, 13 Jun 2005 14:38:08 EDT, Ken Garland said:
I have syslog-ng setup to add hostname dynamically. When a new server is pointed to the central log server it creates a /var/log/syslogs/$hostname dir and all logs from that host are put in there. in /etc/log/rotate.g/syslog-ng I have tried putting in /var/log/syslogs/* and this will not work.
Is there a way for logrotate to search directories recursively?
Think outside the box. ;)
/var/log/syslogs/$hostname/$day will automagically start a new log each day.
Then 'find /var/log/syslogs -type f -mtime +31 -exec rm {} \;' for the cleanup. ;)
------------------------------------------------------------------------
_______________________________________________ syslog-ng maillist - syslog-ng@lists.balabit.hu https://lists.balabit.hu/mailman/listinfo/syslog-ng Frequently asked questions at http://www.campin.net/syslog-ng/faq.html
On Mon, 2005-06-13 at 13:11 -0500, sawall wrote:
so, is there another way to do this, or is my best bet to do the following via cron:
find /pathto/logs/* -ctime +7 -exec rm -f {} \; 2> /dev/null
the problem is that the file _is_ changed, new messages appear in it from time to time as otherwise remove_if_older would remove it on its own, therefore -ctime +7 would not be ok. If you'd add somethink like $R_DAY in your filename, then you'd be safe as that would ensure that no new entries will be written to it for a week. -- Bazsi
participants (4)
-
Balazs Scheidler
-
Ken Garland
-
sawall
-
Valdis.Kletnieks@vt.edu