Huge log file : prod.deprecations.log

Hi everyone,
In SuiteCRM 8.5.0, I have found in logs/prod/ 2 files :

  • prod.deprecations.log
  • prod.log

While prod.log is around 300Mb, the fiel prod.deprecations.log was around…18.5Gb !!
I have renamed the file and put an empty file with the same name to avoid issue, check if all was alright on the CRM and then removed the huge file.
Ok, this working.

But… the file is growing again : since the replacement with an empty file, the file is already at 12,1Mb…

I have checked the file while it is “small”, all inside are indeed “deprecated”.

My question is simple : as “deprecated” is worthless right now for me, can I stop SuiteCRM to generate this specific log file ?
I already have in my php to log only error and fatal but this not stop SuiteCRM to generate this log file…

Thanks for your help,
Xavier

Well… I have to come back to correct what I wrote : dont remove the file prod.deprecations.log !
It breaks some internal page in the CRM on my side : the dashboard, the admin function (not the admin directly but all the internal page like “repair”, etc…).

I had to fetch back a backup from this night to get all back working normally…

So, my question is still there : how to get rid of this huge file without breaking the crm ??

Thanks :slight_smile:
Xavier

No idea, but check your log level in php.ini file and these links. Also, under admin → system settings.

Admin / System settings / Logger Settings

Hi rsp,
The log level in php is set on fatal and error only and shouldn’t log the deprecated but SuiteCRM does…

This can be a huge issue as if I removed or clean the file, this breaks the CRM…

What can I do ? and how to get rid of this files in logs/prod without breaking all ?

Xavier

Those files are Symfony logging, you should look for answers in Symfony documentation.

Thanks PGR,
I’ll do and I’ll come back with the solution found to share with others :slight_smile:

Xavier

1 Like

Hi :slight_smile:
Ok, in config/packages/prod, I have monolog.yaml.

What if I comment the lines for “deprecated” like this :

#     deprecation:
#       type: stream
#       path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"
#     deprecation_filter:
#       type: filter
#       handler: deprecation
#       max_level: info
#       channels: ["php"]

or simply stop the log to the file by changing this :

   deprecation:
      type: console
    deprecation_filter:
      type: filter
      handler: deprecation
      max_level: info
      channels: ["php"]

or

deprecation:
      type: null
    deprecation_filter:
      type: filter
      handler: deprecation
      max_level: info
      channels: ["php"]

I ask because I dont want to “try - mess” and need the expert view from you all :slight_smile:

Thanks for your help :slight_smile:
Xavier

I come back also here for a simple question : can i “clean” (empty the file) the huge log prod.deprecations.log safely ?
Now, the file have a size of…17Gb…

Thanks :slight_smile:
Xavier

I never tried it but I guess it’s ok to delete. Start by just renaming it to something else, if after a while you see that nothing goes wrong, and a new file is created with the newer deprecation messages being generated now, then you know it’s ok to delete the old huge file.

Hello Xavier,

17GB is impressive :smiley:

I’ve searched around in the SuiteCRM code, whether there is ever a read on the log file, but couldn’t find any hints here and with other keywords:
https://github.com/search?q=repo%3Asalesagility%2FSuiteCRM-Core+log->deprecated&type=code

Then I checked over at Symphony for any hints towards logfile deletion etc.

Finally I found a hint at SO - which might not apply to SuiteCRM, but there are some people asking for it and deleting log files:

A neat feature would probably be an inbuild log rotate:

So I just tried and emptied the file (not deleted, just emptied it) and it seems, my CRM is still happy.
Just like with a log rotate, the CRM writes into the empty file now and so far, I haven’t found any issues popping up in the CRM (8.6.1)

Thanks to both of you :slight_smile:

I have found also these links but as SuiteCrm is “touchy” when a file is changed, I was waiting for your expert eyes :slight_smile:

The deprecated log is full of this kind of line :
[2024-08-06 10:41:11] php.INFO: User Deprecated: Since api-platform/core 2.7: Use “ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface” instead of “ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface”. {“exception”:“[object] (ErrorException(code: 0): User Deprecated: Since api-platform/core 2.7: Use "ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface" instead of "ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface". at /home/xxxx/xxxx/vendor/api-platform/core/src/Symfony/EventListener/DeserializeListener.php:63)”} []

And even with directive in config/packages/prod/monolog.yaml. like this at the end of the file :

 deprecation:
      type: stream
      path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"
    deprecation_filter:
      type: filter
      handler: deprecation
      max_level: info
      channels: ["php"]

the deprecations log continue to grow… As I wrote “stream”, it should’nt…

Ok,
So far, as soon i rename the deprecation log, the system recreate a new one, that’s ok.
But as soon I do this, I loose the Dashboard (nothing shown but the menu is working) and several part are also not responding (Studio, etc…).

I’m restoring the version before I change this… I dont understand what is happening, it shouldn’t mess the crm like this…
Xavier

Are the ownerships and permissions on the newly created log file correct?

Yes, check, check, check, re-check…

I’ve actually not deleted the file, I’ve just emptied the content … (after making a copy)

vi prod.deprecations.log // sudo -u www-data vi in case you want to edit as the www-data user
:%d
:w! // Enter for saving the file

But it should work if you simply create the file with the correct permission as well.
I haven’t changed anything in configs / yaml or similar, the rest is just a standard Ubuntu LAMP server.

Sure, but I cannot empty the file as it is too big to open…

There are multiple way to do this in Linux:

1:
: > access.log
2:
true > access.log
3:
cat /dev/null > access.log
4.
cp /dev/null access.log
5.
dd if=/dev/null of=access.log
6.
echo -n "" > access.log
7.
echo -n > access.log

Found on StackOverflow

1 Like