Page 1 of 1

PHP Log Cleanup.

Posted: Fri Aug 31, 2018 3:24 pm
by zenbarber
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.

Re: PHP Log Cleanup.

Posted: Wed Sep 12, 2018 2:07 pm
by chrisbirk
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