2

recently I noticed that there is a file name "error_log" in the home directory of my magento system (around 6.5gb). Any idea what is the purpose of the file and any ways to shrink it? As it's eating up my server space.

Note: I don't think this is the log size in my database, since it is a separate file sitting in the home directory. Thanks!

  • magento log files are lying in var/log. This must be some other logs. – Rajeev K Tomy Aug 14 '14 at 6:54
  • Not sure about it, I have installed my magento in public_html. So this error_log file just sits over there, and updated daily. – user12750 Aug 14 '14 at 6:56
  • Can you post some recent lines from the file? May be it's php error log. – Amasty Aug 14 '14 at 6:59
  • Thanks Amasty, due to large file size I may need hours to download the file itself before opening. I was hoping if anyone knows the purpose of this file and if there is any way to reduce or perhaps delete the file? – user12750 Aug 14 '14 at 7:06
  • [14-Aug-2014 05:18:30 America/Chicago] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php53/lib/php/extensions/pdo_mysql.so' - /usr/local/php53/lib/php/extensions/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 [14-Aug-2014 05:18:30 America/Chicago] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php53/lib/php/extensions/ixed.5.2.lin' - /usr/local/php53/lib/php/extensions/ixed.5.2.lin: cannot open shared object file: No such file or directory in Unknown on line 0 – user12750 Aug 14 '14 at 10:24
2

This file isn't a part of standard Magento. Based on the comments posted it sounds like someone, at one time, configured PHP (either via php.ini or via a call to ini_set) to log its errors to this file. It's also possible that your web server (Apache or nginx, most commonly) is configured to use this file as an error log. (as PHP errors are passed along to the webserver's error logs)

From a technical perspective you should be able to safely remove this file. I would

  1. Make note of the unix permissions on this file
  2. Use the mv command to move this file elsewhere on disk. A mv should be a quick operation, even for a large file
  3. Create a new file with the same name in the same spot. Make sure this file has the same unix permissions from #1.

If something explodes when you move the file, move it back. If nothing explodes you can delete the file or back it up somewhere off your server.

Monitor the new file you created. If its growing regularly then I'd look into setting up your system to regularly rotate this file with a command like logrotate. This command will gzip you logs for storage and then zero out the actual file. This is usually enough to control disk size.

I'd also suggest you address any PHP errors cropping up in the logs -- but I know how priorities usually go there.

Good luck!

1

This is most likely either your Apache or Nginx error_log. If you post the last few lines here we'll be able to easily identify it. To view the last 10 lines run the following command:

tail -10 error_log
  • Too much character, so I just pasted the last line: [14-Aug-2014 05:18:30 America/Chicago] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php53/lib/php/extensions/ixed.5.2.lin' - /usr/local/php53/lib/php/extensions/ixed.5.2.lin: cannot open shared object file: No such file or directory in Unknown on line 0 Those before this line are something similar, but targeting at different file names. – user12750 Aug 14 '14 at 10:17
  • @user12750 think your paste failed. Edit your original question. – Dave Aug 14 '14 at 10:18
  • @user12750 is that same error repeated numerous times? Here's a solution for fixing that issue: forums.cpanel.net/f5/… – Dave Aug 14 '14 at 10:24
1

This does not deal with preventing the errors, but a way to keep the error_log file smaller is to look for the logrotate settings. It depends on your hosting setup how you should do this (control panels usually have options for this). If you have enough privileges you could edit settings in /etc/logrotate.conf or run logrotate using a cronjob.

If all this is gibberish, ask your hosting provider to take care of this.

  • @user12750 were you able to reduce the log file? – willem wigman Aug 18 '14 at 9:09
  • Yes, apparently it belongs to server, managed to get my host to check on it. However it seems that Magento is the one that post errors to the server and thus resulting a big error_log file as it has been looping. Not sure what could have happen since the website is running fine. Nevertheless, I have the file removed and will monitor it. – user12750 Aug 20 '14 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.