Huge nextcloud.log file (116 GB!)

Nextcloud version 20.0.8
Operating system and version Ubuntu 18.04.5 LTS‬ via Plesk Obsidian 18.0.33 Update #1
PHP version 7.3.27

I was running into Disk Space problems on my VPS, but I only had about 50GB of data stored (and I deleted a lot of files going down to 25 GB, still facing problems).

So I did some research and found that my nextcloud.log file is 116 GB. This is the first time I encountered this problem.

When clicking on Admin → Logging Nextcloud loads and loads and loads (no wonder, with 116 GB of logs).

What could be the problem causing this?

And more importantly, how do I get rid of this huge log file? Can I just delete the file?

Any help appreciated, because currently it renders my Nextcloud installation pretty useless.

Thanks in advance!

Update 1: There is another nextcloud.log file with 17,7 GB as well.

Not sure if it was there before, but seems like my logging is running amok…

Update 2: Now I can’t even use Plesk anymore, because the disk is so full. So I can’t even access the file manager to delete then nextcloud.log files anymore.

I am currently trying to navigate my way around with the via ssh and command line, but that takes forever, because I have to look up every single command… :wink:

I even forgot “cd” and “ls -a”…

Update 3: Ok, so as this was blocking everything here I just risked it, went in via ssh and truncated the nextcloud.log and nextcloud.log.1 files to zero.

Following roughly this post here: Clear logfile NOT logrotate [SOLVED]

I then could login into Plesk again and found 3 nextloud.log files, one with 116 GB still, so I guess there was a second nextcloud.log file. But deleted all 3 nextcloud.log files and it seems to have worked. Now there is a new nextcloud.log file, but it is still with 0 B, so I don’t think it is filling that quickly. Will need to monitor this.

you can delete the log file “rm /file/path/nextcloud.log”
have a look into the file what the logs are about or make a “tail -f /file/path/nextcloud.log” to see what get written at the moment to it

1 Like

Hi kinimodmeyer!
Thank you for your response. I did what you mentioned (just a slightly different and more complicated way, as I am not too familiar with the command line anymore.

Thank you for your support. I was a little desperate and as the whole VPS was blocked I just went for it and thought “what more could I break?!” :crazy_face:

I will need to follow things a little bit now, but at the moment the nextcloud.log file that was created automatically is at 0B, so seems like it is not written that quickly anymore.

OK, now I used a couple of things in Nextcloud and the log file is at 10.8 GB. This is crazy. What the heck is Nextcloud logging?
I am currently downloading it, but download is slow and I am not sure if I’ll be able to open a 10 GB text file…

The log file is now already at over 2GB again. I downloaded it with around 600 MB and it looks something like this:

Not sure what this is, can’t make much of it.

I think it has to do with Onlyoffice, which is causing some problems at the moment. Well, back to Google Docs, I guess.

Hi @Holch, which log level do you use?
maybe add this line to your config.php : 'loglevel' => 2,
this line set log to write only error or higher

Maybe you should see what error create so many lines.

1 Like

Hi Mageunic, thank you for you reply.

I am not sure what loglevel I use. I guess the standard one. :wink:

I guess I would find that in the config file of Nexcloud. Let me see…

Here we go, ‘loglevel’ => 2,

So it is already on that level.

I downloaded one of the (smaller) log files and opened them, but the format is crazy. From what I could see, the errors were generated by OnlyOffice and by one specific user.

{"reqId":"56BzewIvUGb3lihWlCWG","level":3,"time":"2021-03-22T17:57:31+00:00","remoteAddr":"189.33.13.223","user":"--","app":"index","method":"POST","url":"/index.php/apps/documentserver_community/3rdparty/onlyoffice/documentserver/doc/3746911248/c/232/yrahzqbv/xhr_send?t=1616435552969","message":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing 'INSERT INTO `oc_documentserver_ipc` (`session_id`, `time`, `message`) VALUES(?, ?, ?)' with params [\"session_yrahzqbv\", 1616435850, \"{\\\"type\\\":\\\"authChanges\\\",\\\"changes\\\":[{\\\"docid\\\":\\\"3746911248\\\",\\\"change\\\":\\\"\\\\\\\"45;KQAAAAEACQECAAAANgABJwAAAAkAAAAnAAAACQAAAAAJAAAAAAIJAQInAgIE\\\\\\\"\\\",\\\"time\\\":1615231568000,\\\"user\\\":\\\"ocpbmrfllsyj_pdb-as1\\\",\\\"useridoriginal\\\":\\\"ocpbmrfllsyj_pdb-as\\\"}

And so on and so on.

Not sure what it means but I deactivated OnlyOffice and things are calmer now. I am not an IT guy and I had to step out so many fires today, that I am glad that at least the log file isn’t growing anymore and I have switched everything back to Google Sheets. I had just too many problems with OnlyOffice lately. Once things are calmer I might have another look at this, but I fear that the users are “lost” to Google Sheets now and they will probably not want to try OnlyOffice again.

1 Like

@Holch I’m not using Community Document Server apps and I don’t know what is the error exactly. If you are brave you can install onlyoffice packages for the real server.

see: Installing ONLYOFFICE Docs for Debian, Ubuntu, and derivatives - ONLYOFFICE
if you want some help, let me now.

there is just a bug with the plugins menu but it is set in the next update

Thank you very much for the offer to help.

For now I will wait until things are getting calmer with the projects and then I might give it another try. I am just glad that I could kill this mad logging problem and can use my Nextcloud, even without OnlyOffice. :wink:

1 Like

Here is a general solution to take care of logfiles: install logrotate.
Once that’s done, have this in /etc/logrotate.d/nextcloud:

/your_log_path/the_log_file.log {
	maxsize 10M
	daily
	missingok
	rotate 3
	compress
	notifempty
}

Look at the possible options for more customizing in man logrotate.
This setup means you will end up with 3 files: nextcloud.log, nextcloud.log.1.gz, nextcloud.log.2.gz
nextcloud.log will be compressed and renamed into nextcloud.log.1.gz on a cron schedule daily, and during the day if it gets larger than 10MB, unless it is empty. And if it goes missing, don’t throw an error.
nextcloud.log.1.gz will be renamed into nextcloud.log.2.gz, and nextcloud.log.2.gz will be deleted.

Check that it works with logrotate --force --verbose /etc/logrotate.d/nextcloud

1 Like