CyberHosting

Disk usage increasing & how to add more resources

Hi Team,

I have been monitoring my disk usage from past one week, as I am currently hosting cyberpanel on GCP so at the time of installation I choose 25GB SSD as storage for VM.

I only have 2 wordpress installation & haven't configured any backup's currently. Last week my disk usage were around 22% after installing 2 website with some demo content & now it's showing 29% check this image here--> https://pasteboard.co/Iunm8GC.jpg

While 2 days back it was showing 26% disk usage, also I recently upgraded to version 1.9.

So can you tell me if their some kind logs or backup that is generated & stored on the server, if yes how can I clean to recover any disk space.

Also please tell me how can I add more storage as in If I add disk space to the Virtual machine will cyberpanel recognize it automatically after a server reboot or I need to follow some more steps.

Thanks.

Comments

  • Since upgrading to 1.8.9, disk usage is increasing automatically. My 200 GB disk filled up within a week. It was only around 15GB before updating to 1.8.9
  • Can you guys try this guide https://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/

    Try to find large directores/files. I don't think this is related to v1.8.9.
  • edited September 13

    Can you guys try this guide https://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/

    Try to find large directores/files. I don't think this is related to v1.8.9.

    For me, it's my /usr/local/lsws/logs folder that is full of error log files (29GB right now) after a week of usage.

    How can I disable logging or set this up so that I don't have to manually empty the folder.
  • Hi @CyberPanel

    Is their any option in Cyberpanel where can we enable automatic deletion of log files older than few days or week .

    Error log files accumulate very fast, hope you consider this. If their is no option presently to do so with user interface instead of manually deleting via command line.
  • I already told you where the files were. . .

    "For me, it's my /usr/local/lsws/logs folder that is full of error log files (29GB right now) after a week of usage."

    and then I asked a direct way of resolving the issue too. . .

    "How can I disable logging or set this up so that I don't have to manually empty the folder.
    "
  • Are they errors of a website or of the litespeed itself?
  • change log keep days to like 7 days vs 30 for highly active sites and possibly switch off the Debug

    grep log /usr/local/lsws/conf/httpd_config.xml



    https://www.litespeedtech.com/docs/webserver/config/slog#log_debugLevel




    $SERVER_ROOT/logs/error.log

    0
    10M
    1
    1


    $SERVER_ROOT/logs/access.log
    10M
    30 <<<<<<<<<change
    <compressArchive>0

  • You can do this by logging into your lsws webconsole and editing the access.log and error.log

    Click the edit icon in the actions section.

    lsws default is DEBUG which will log everything. After inspection of your log files to ensure the majority are just [INFO] and not actual errors you can significantly cut down the amount of logs being created by changing it to ERROR

    If you still need to automatically remove logs then I would look at either logrotate and creating something specific for lsws or creating a crontab entry to remove the files.

  • Click `Logs' on side panel and amongst the editable logs is `Error Logs'. Click that and you have the list and at the bottom the option to `Clear Logs' (no cli required)...
  • That only clears the last 50 lines. Wont remove rotated logs by lsws
  • Fair enough. I would use dolphin file manager on my pc with ssh access to create a fast gui with root available...
  • I looked into this again and see I'm getting tons of rotated error logs.


    [root@wcloud:/usr/local/lsws/logs]# ls -lah
    total 5.2G
    drwxr-x--- 2 root nobody 68K Oct 8 14:05 .
    drwxr-xr-x 26 root root 4.0K Sep 30 11:28 ..
    -rw-r--r-- 1 nobody nobody 792 Sep 30 13:06 access_log
    -rw-r--r-- 1 nobody nobody 15K Sep 30 12:30 access.log
    -rw-r--r-- 1 nobody nobody 1.4M Oct 8 12:08 auditmodsec.log
    -rw-r--r-- 1 nobody nobody 6.2M Oct 8 14:31 error.log
    -rw-r--r-- 1 nobody nobody 3.2M Sep 30 12:47 error.log.2019_09_30
    -rw-r--r-- 1 nobody nobody 2.3M Sep 30 13:04 error.log.2019_09_30.01
    -rw-r--r-- 1 nobody nobody 1.2M Sep 30 13:09 error.log.2019_09_30.02
    -rw-r--r-- 1 nobody nobody 3.5M Sep 30 13:18 error.log.2019_09_30.03
    -rw-r--r-- 1 nobody nobody 12M Sep 30 13:34 error.log.2019_09_30.04
    -rw-r--r-- 1 nobody nobody 11M Sep 30 14:17 error.log.2019_09_30.05
    -rw-r--r-- 1 nobody nobody 11M Sep 30 14:43 error.log.2019_09_30.06

    Checking most of these error logs are under 7 days old.
    [root@wcloud:/usr/local/lsws/logs]# find /usr/local/lsws/logs/error.log.* -mtime +7 -type f | wc -l
    6

    The majority of these are within a day old which is outrageous.
    [root@wcloud:/usr/local/lsws/logs]# find /usr/local/lsws/logs/error.log.* -mtime +1 -type f | wc -l
    376
    [root@wcloud:/usr/local/lsws/logs]#

    After cleared:
    [root@wcloud:/usr/local/lsws/logs]# du -h /usr/local/lsws/logs/
    1.5G /usr/local/lsws/logs/
    [root@wcloud:/usr/local/lsws/logs]#

    There is an even easier way to fix this if you do not want to change the keepdays or logging level via the Litespeed web admin panel.

    Use the below in a cronjob adjusted for how long you want the oldest files to be.
    0 1 * * * find /usr/local/lsws/logs/error.log.* -mtime +1 -type f delete >/dev/null 2>&1

    The -mtime is the time of the file age. Anything older than 1 day will be selected for deletion in this example.

    find /usr/local/lsws/logs/error.log.* -mtime +1 -type f delete

    I highly advise first testing it without the delete directive to ensure it's finding the desired files which are taking up space.

    find /usr/local/lsws/logs/error.log.* -mtime +1 -type f

    As it logs "error.log.*" this is why my example is this way.

    Once you tested it then you can test with the delete option and if that works to your liking simply set it up as a cronjob via the root user.

    find /usr/local/lsws/logs/error.log.* -mtime +1 -type f delete

    Once decided on the command create the job as root user.
    crontab -e
    0 1 * * * find /usr/local/lsws/logs/error.log.* -mtime +1 -type f delete >/dev/null 2>&1

    Enjoy no more worries about disk space. :)

    This is going to be way easier than trying to set up logrotate on top of the rotation litespeed/openlitespeed already has going.
Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!