LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-10-2018, 08:14 AM   #1
awreneau
Member
 
Registered: Aug 2003
Location: GA
Distribution: Ubuntu
Posts: 42

Rep: Reputation: 15
maillog 90 day retention


Business requirements define maillog retention @ 90 days. I've commented out /var/log/maillog in /etc/logrotate.d/syslog, commented out compression ( I may change that later) and created a new file for maillog in the same directory w/ the following content

Code:
/var/log/maillog {
#    compress
    daily
     rotate 90
    create 0600 root root
        postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}
My reservation is the HUP of syslogd.pid. Is that legit? Only the syslog file contains a similar line.

Thanks
WR
 
Old 12-10-2018, 09:17 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,469

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Looks legit and similar to what's in my logrotate config for maillog
 
Old 12-10-2018, 09:34 AM   #3
awreneau
Member
 
Registered: Aug 2003
Location: GA
Distribution: Ubuntu
Posts: 42

Original Poster
Rep: Reputation: 15
Thanks!

I think the syslog line is irrelevant as I'm running rsyslog on CentOS 7.5.
Thoughts?

Code:
# ps -ef | grep syslog | grep -v grep
root       949     1  0 Oct01 ?        00:03:36 /usr/sbin/rsyslogd -n

Last edited by awreneau; 12-10-2018 at 09:35 AM. Reason: Etiquette
 
Old 12-10-2018, 09:39 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,469

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
If that's the only syslog style daemon running, then yeah, makes sense to omit the other one.
 
Old 12-10-2018, 02:08 PM   #5
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,719

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by lhadi4581 View Post
I'm running Postfix Sendmail 2.6.6 and my SMTP logs seem to only be going back one month. How can I configure it to retain logs for a longer period of time?
If you have a question of your own, please open a new thread.
Be prepared in that thread to tell us what you've found in your searches and what you've tried.
 
Old 12-11-2018, 10:41 AM   #6
awreneau
Member
 
Registered: Aug 2003
Location: GA
Distribution: Ubuntu
Posts: 42

Original Poster
Rep: Reputation: 15
1st of thanks for the help.

I think I've found success. Originally I posed the question about which logging mechanism I should use. Turns out syslog was the correct afterall
Code:
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
I experimented with a few options but have settled on the following.

/etc/logrotate.d/maillog
Code:
/var/log/maillog
{
    missingok
    daily
    dateext
    rotate 90
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}
I'm not certain why but for a few iterations rsyslog was still had open connections to the rotated log file /var/log/maillog-20181211 and was not writing to the new /var/log/maillog. I had to restart rsyslogd in order for it to behave properly. However, I must've solved it unknowingly as it now works as expected. Thought I'd just update my post and leave this here for posterity.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: On GPG and data retention LXer Syndicated Linux News 0 09-15-2007 05:41 PM
why is maillog on my server getting created in /var/log/maillog.3 ? weblink_dipti Linux - Software 2 06-16-2007 04:47 AM
LXer: EU officials warn Google on search data retention LXer Syndicated Linux News 0 05-29-2007 10:16 AM
How to adjust log retention? kailun Linux - Security 1 02-22-2006 01:22 PM
Limited retention of files.... GiX Linux - Newbie 3 01-25-2006 02:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration