[syslog-ng] (U) [Non-DoD Source] Re: Rotate syslog-ng log files
Amin, Jitesh CTR DISA JSP (US)
jitesh.amin.ctr at mail.mil
Wed May 30 12:39:09 UTC 2018
CLASSIFICATION: UNCLASSIFIED
Hello,
So I updated configuration to have following in my conf file:
destination syslog { file("/var/log/syslog-${YEAR}-${MONTH}-${DAY}.log"); };
and syslog-ng restarted file,
But now I see 2 log files in /var/log
Syslog.log
syslog-{YEAR}-{MONTH}-{DAY}.log
Not sure why it’s creating syslog-{YEAR}-{MONTH}-{DAY}.log named file versus actually putting day/month/year in file name. Anything I missed??
Thanks
Jitesh Amin
CLASSIFICATION: UNCLASSIFIED
From: syslog-ng <syslog-ng-bounces at lists.balabit.hu> On Behalf Of Scheidler, Balázs
Sent: Wednesday, May 30, 2018 8:03 AM
To: Syslog-ng users' and developers' mailing list <syslog-ng at lists.balabit.hu>
Subject: Re: [syslog-ng] (U) [Non-DoD Source] Re: Rotate syslog-ng log files
All active links contained in this email were disabled. Please verify the identity of the sender, and confirm the authenticity of all links contained within the message prior to copying and pasting the address to a Web browser.
_____
Yep, that would give you one logfile every day. It will not care about whether it reached 500mb though. But on the plus side that gives you a trivial way to identify which file holds a specific date, which is pretty cumbersome otherwise.
On May 30, 2018 07:52, "Amin, Jitesh CTR DISA JSP (US)" <jitesh.amin.ctr at mail.mil < Caution-mailto:jitesh.amin.ctr at mail.mil > > wrote:
CLASSIFICATION: UNCLASSIFIED
Hello,
So here's what currently is configured in our .conf file:
destination syslog { file("/var/log/syslog.log" perm(0644)); };
what you are saying, is if I want logs to rotate on daily basis, I can just make the above line to read as following:
destination syslog { file("/var/log/syslog-${YEAR}-${MONTH}-${DAY}.log"); };
Thanks
Jitesh Amin
CLASSIFICATION: UNCLASSIFIED
-----Original Message-----
From: Gergely Nagy <algernon at balabit.com < Caution-mailto:algernon at balabit.com > >
Sent: Wednesday, May 30, 2018 7:25 AM
To: Amin, Jitesh CTR DISA JSP (US) <jitesh.amin.ctr at mail.mil < Caution-mailto:jitesh.amin.ctr at mail.mil > >; syslog-ng at lists.balabit.hu < Caution-mailto:syslog-ng at lists.balabit.hu >
Subject: [Non-DoD Source] Re: [syslog-ng] (U) Rotate syslog-ng log files
All active links contained in this email were disabled. Please verify the identity of the sender, and confirm the authenticity of all links contained within the message prior to copying and pasting the address to a Web browser.
----
Hi!
>>>>> "Amin" == Amin, Jitesh CTR DISA JSP (US) <jitesh.amin.ctr at mail.mil < Caution-mailto:jitesh.amin.ctr at mail.mil > > writes:
Amin> What we are trying to do is rotate the syslog.log file once it
Amin> reaches 500 MB (as well as looking into rotating file every 24
Amin> hours)? Once the log file rotates, it creates a new file named
Amin> syslog.log.0 and so on..
syslog-ng does not support size-based rotation, you'll have to configure logrotate for that. See the packaging/debian/syslog-ng-core.syslog-ng.logrotate[1] file for an example.
[1]: Caution-Caution-https://github.com/balabit/syslog-ng/blob/master/packaging/debian/syslog-ng-core.syslog-ng.logrotate < Caution-https://github.com/balabit/syslog-ng/blob/master/packaging/debian/syslog-ng-core.syslog-ng.logrotate >
With logrotate, the most recent logfile syslog-ng writes to will always be syslog.log, and the rotated files will have different names - depending on the logrotate configuration you use.
For time-based, daily rotation, you can use templates in the destination filename, such as:
destination d_syslog {
file("/var/log/syslog-${YEAR}-${MONTH}-${DAY}.log");
};
Hope this helps!
--
|8]
______________________________________________________________________________
Member info: Caution-https://lists.balabit.hu/mailman/listinfo/syslog-ng < Caution-https://lists.balabit.hu/mailman/listinfo/syslog-ng >
Documentation: Caution-http://www.balabit.com/support/documentation/?product=syslog-ng < Caution-http://www.balabit.com/support/documentation/?product=syslog-ng >
FAQ: Caution-http://www.balabit.com/wiki/syslog-ng-faq < Caution-http://www.balabit.com/wiki/syslog-ng-faq >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20180530/cd101397/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6560 bytes
Desc: not available
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20180530/cd101397/attachment-0001.bin>
More information about the syslog-ng
mailing list