PHP Log Cleanup.

General discussion on Zend Server for IBM System i
Post Reply
zenbarber
Posts: 7
Joined: Tue Aug 18, 2009 11:03 am

PHP Log Cleanup.

Post by zenbarber » Fri Aug 31, 2018 3:24 pm

Hello, I hope someone can help or point me in the correct direction.

Our /usr/local/zendsvr6/var/log/php.log has grown to be over 1Gb in size.

How can this, and other logs, be automatically cleared to only keep a sensible amount of entries and so keep the log sizes sensible ?

Many Thanks.

chrisbirk
Posts: 10
Joined: Fri Oct 12, 2012 11:03 pm

Re: PHP Log Cleanup.

Post by chrisbirk » Wed Sep 12, 2018 2:07 pm

I read somewhere about this and so this is what I do.

I created CL that will rename the log file (which will force a new file) every month. I have it set up in wrkjobscde to run monthly. Of course I am on zendphp7, so you will need to change the path to be zendsvr6 and of course when you move to zendserver 2018 don't forget to recompile this.

PGM
DCL VAR(&TIMESTAMP) TYPE(*CHAR) LEN(20)
DCL VAR(&NEWNAME) TYPE(*CHAR) LEN(30)
RTVSYSVAL SYSVAL(QDATETIME) RTNVAR(&TIMESTAMP)
CHGVAR VAR(&NEWNAME) VALUE('php.log.' *CAT &TIMESTAMP)
RNM OBJ('/usr/local/zendphp7/var/log/php.log') +
NEWOBJ(&NEWNAME)
ENDPGM

chris

zenbarber
Posts: 7
Joined: Tue Aug 18, 2009 11:03 am

Re: PHP Log Cleanup.

Post by zenbarber » Tue Oct 30, 2018 1:26 pm

Thank you Chris, very much appreciated.

Post Reply