Jump to content

Featured Replies

Posted
comment_289

I've noticed a very large log file into /usr/local/cwp/php71/var/log/php-fpm.log Does anyone knows how to setup a logrotate entry to keep that log and others on that folder under control?

Thanks in advance!

Edited by Fidolas

Solved by Sandeep B.

Go to solution
  • Solution
comment_290
7 hours ago, Fidolas said:

I've noticed a very large log file into /usr/local/cwp/php71/var/log/php-fpm.log Does anyone knows how to setup a logrotate entry to keep that log and others on that folder under control?

Thanks in advance!

You can use this tutorial to clear the logs via cron job : 

 

or you can use below configs for logrotate :

yum install logrotate -y

create the cwp logrotate config file :

nano /etc/logrotate.d/cwplog

add this lines to it and save :

/usr/local/cwp/php71/var/log/*.log
/var/log/cwp/*.log
{
    daily
    rotate 3
    size 15M
    compress
    dateext
    dateformat -%d-%m-%Y
    delaycompress
}

you can debug/dry-run the log rotate config via this command :

logrotate -d /etc/logrotate.d/cwplog

disable system protect for logrotate :

sed -i '/ProtectSystem=full/s/^/#/g' /usr/lib/systemd/system/logrotate.service
systemctl daemon-reload

and restart logrotate.timer and logrotate via systemctl : 

systemctl restart logrotate.timer logrotate

check logrotate.timer and logrotate are running via this command :

** logrotate will show inactive other than that ensure the service doesn't have any error

systemctl status logrotate.timer logrotate
  • 1 month later...
comment_376

HI, thank you very much dear Sandeep for you nice comprehensive answer

 

just I would to ask about this line: 

/usr/local/cwp/php71/var/log/*.log

 

incase using php 8.1 instead of the php 7.1, it's nee to change: /usr/local/cwp/php81/var/log/*.log  or it's not necessary 

 

 

thanks

comment_377

HI, when I run the the above command, getting the below error:

 


[root@cloud ~]# systemctl restart logrotate.timer logrotate
Failed to restart logrotate.timer: Unit not found.
Failed to restart logrotate.service: Unit not found.
[root@cloud ~]# systemctl status logrotate.timer logrotate
Unit logrotate.timer could not be found.
Unit logrotate.service could not be found.

please guide me

 

thanks.

  • Author
comment_413
On 1/3/2024 at 7:51 PM, Navid said:

HI, thank you very much dear Sandeep for you nice comprehensive answer

 

just I would to ask about this line: 

/usr/local/cwp/php71/var/log/*.log

 

incase using php 8.1 instead of the php 7.1, it's nee to change: /usr/local/cwp/php81/var/log/*.log  or it's not necessary 

 

 

thanks

CWP only uses PHP 7.1 and not 8.1. You can use any PHP version you want on your server but CWP will use always the 7.1 version. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now