[syslog-ng] logrotate again...

Justin Randall jrandall at comwave.net
Wed Dec 6 17:53:28 CET 2006


Slight correction on the command syntax:

> find /var/log -type f -exec sed -if <sed script filename> {} \;

Should be

find /var/log -type f -exec sed -f <sed script filename> --in-place {}
\;

Cheers.

-----Original Message-----
From: Justin Randall 
Sent: Wednesday, December 06, 2006 11:21 AM
To: 'Syslog-ng users' and developers' mailing list'
Subject: RE: [syslog-ng] logrotate again...

>find /var/log -type f -exec sed -i '/15 Nov/d'  {} \; should work - is
untested, though :)

If I'm not mistaken this will only remove lines containing '15 Nov'.  If
you want something that will eliminate all logs prior to that date you
could write a sed script like the following:

= begin sed script =
/./,/15 Nov/{
d
}
= end sed script =

If you had another date range in mind you could also do the following:

= begin sed script =
/13 Nov/,/15 Nov/{
d
}
= end sed script =

Once you have your sed script simply invoke it similar to the above
method:

find /var/log -type f -exec sed -if <sed script filename> {} \;

Hope this helps,

Justin.

-----Original Message-----
From: Andrej Ricnik-Bay [mailto:andrej.groups at gmail.com] 
Sent: Tuesday, December 05, 2006 3:44 PM
To: Syslog-ng users' and developers' mailing list
Subject: Re: [syslog-ng] logrotate again...

On 12/6/06, Vadim Pushkin <wiskbroom at hotmail.com> wrote:

> 2. The other issue that I am having is that I wish to rotate now, my
> filesystem is fill, but since I did not rotate, all of my logfiles are
one.
> How can I prune them of any data prior to say 15 Nov for *each*
logfile?
find /var/log -type f -exec sed -i '/15 Nov/d'  {} \;
should work - is untested, though :)


>  Thank you again,
>
> .vp
Cheers
_______________________________________________
syslog-ng maillist  -  syslog-ng at lists.balabit.hu
https://lists.balabit.hu/mailman/listinfo/syslog-ng
Frequently asked questions at http://www.campin.net/syslog-ng/faq.html






More information about the syslog-ng mailing list