Koozali.org: home of the SME Server

Keep Log files for longer

Offline shawnbishop

  • *****
  • 298
  • +0/-0
Keep Log files for longer
« on: May 04, 2010, 09:53:14 AM »
Good Day

I regularly have to check my qpsmtpd and qmail logs, but as the server is so busy it rotates the logs at 4.8mb, and only keeps a weeks history, I would like to keep 30 days worth of logs, how would i do it?

Shawn

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Keep Log files for longer
« Reply #1 on: May 04, 2010, 10:49:58 AM »
I regularly have to check my qpsmtpd and qmail logs, but as the server is so busy it rotates the logs at 4.8mb, and only keeps a weeks history, I would like to keep 30 days worth of logs, how would i do it?
You need to create custom template fragments for the logrotate configuration files for the affected services and add the desired settings in there. More details on the how the templating system works can be found in the SME Serve Developers Guide in the wiki. The logrotate stuff is mostlikely availbale on the internet or in the man pages. I do not have more time to work things out for you in a step by step plan ATM, sorry.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Daniel B.

  • *
  • 1,700
  • +0/-0
    • Firewall Services, la sécurité des réseaux
Re: Keep Log files for longer
« Reply #2 on: May 04, 2010, 11:45:20 AM »
You need to create custom template fragments for the logrotate configuration files for the affected services and add the desired settings in there.
Logs for mail services (qpsmtpd and qmail) are not handled by logrotate. there're open bugs to customize the number of logs to keep:

qmail: http://bugs.contribs.org/show_bug.cgi?id=5855
qpsmtpd: http://bugs.contribs.org/show_bug.cgi?id=2862


Regards
C'est la fin du monde !!! :lol:

Offline shawnbishop

  • *****
  • 298
  • +0/-0
Re: Keep Log files for longer
« Reply #3 on: May 04, 2010, 05:53:54 PM »
Thanks very much..

Added the lines in the diff files to the run files under qmail and qpsmtpd, will see if the logs are larger

Cheers.

Offline shawnbishop

  • *****
  • 298
  • +0/-0
Re: Keep Log files for longer
« Reply #4 on: May 04, 2010, 06:26:02 PM »
Ok..I have added the patch to the run files for qpsmtpd / qmail and sqpsmtpd ..do I have to run db config setprop qmail KeepLog = x ??

Offline Daniel B.

  • *
  • 1,700
  • +0/-0
    • Firewall Services, la sécurité des réseaux
Re: Keep Log files for longer
« Reply #5 on: May 04, 2010, 06:30:06 PM »
Yes. The patch proposed in those two bugs don't change the size of each log file (which will still be 5MB), but lets you customize the number of logs to keep, for example:
Code: [Select]
db configuration setprop qmail KeepLog 50
sv t /service/qmail
db configuration setprop qpsmtpd KeepLog 50
sv t /service/qpsmtpd
db configuration setprop sqpsmtpd KeepLog 50
sv t /service/sqpsmtpd

Keep in mind that upgrades will remove this until the patches are accepted in the core package.
C'est la fin du monde !!! :lol:

Offline kryptos

  • *****
  • 245
  • +0/-0
Re: Keep Log files for longer
« Reply #6 on: March 03, 2011, 04:12:21 AM »
Hello,

Just want to know if we could have emailed the logs also. I want to keep all the record logs for qpsmtpd but I want the logs save externally I have less space on this server.

Regards,
Rocel

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Keep Log files for longer
« Reply #7 on: March 03, 2011, 07:25:46 AM »
Just want to know if we could have emailed the logs also. I want to keep all the record logs for qpsmtpd but I want the logs save externally I have less space on this server.
I think easiest would be to setup a script that will sync the logs with an external server/storage periodically.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)