Hi,
I encountered a PHP error during a trace log export through the OPNsense web interface.
OPNsense 21.1-amd64
FreeBSD 12.1-RELEASE-p12-HBSD
OpenSSL 1.1.1i 8 Dec 2020
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 363944728 bytes) in /usr/local/opensense/mvc/app/library/OPNsense/Core/Backend.php on line 138
I think the log size is over 200MB.
My first guess is to increase the PHP variable "memory_limit".
But I don't know where to do it to be persistent.
I only found this post related to PHP:.
https://forum.opnsense.org/index.php?topic=3573.msg12174#msg12174
Multiples files are mentioned.
/usr/local/lib/php.ini
/usr/local/etc/php.ini
/usr/local/etc/rc.php_ini_setup
I don't want to mess up the setup.
Any help is welcome.
Regards
Patch for upcoming 21.7 is here: https://github.com/opnsense/core/commit/6d1b3ceab
Apply and activate using:
# opnsense-patch 6d1b3ceab
# configctl webgui restart
As mentioned, the patch will be part of the 21.7 release series so whenever you update 21.1.x the patch will be removed and you need to reapply.
Cheers,
Franco
Awesome.
Thanks for your help.
I will try ASAP ;)
Hello,
Thanks again for your patch, however we still have a problem related to this since we are facing the same error message :
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /usr/local/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LogController.php on line 83
As you can see, it needs a few more memory we are guessing.
Thanks for your help
Cheers
You can increase the limit as you wish, but at some point you hit a RAM hard limit. It would be better to adjust whatever you are trying to do with the excessive logging.
Cheers,
Franco
Hi,
We tried today with this log file.
239M /var/log/filter.log
But it seems that the more we give, the more it asks.
cat /usr/local/opnsense/service/templates/OPNsense/WebGui/php.ini | grep memory_limit
memory_limit = 1700M
[26-Jul-2021 10:56:57 Europe/Paris] PHP Fatal error: Allowed memory size of 1782579200 bytes exhausted (tried to allocate 4096 bytes) in /usr/local/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LogController.php on line 83
Do you know what might be the problem ?
Regards
Please do not use more than 100 MB for circular log files. The log file read time increases exponentially when adding more space to it.
Cheers,
Franco