error.log file size is increasing

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sneha.irali
Posts: 141
Joined: Fri Jan 15, 2021 3:56 am

error.log file size is increasing

Post by sneha.irali »

Hi Team,

As checked I see the below errors been captured on the error.log file under /var/log/httpd/ path.

[Tue Apr 20 01:42:13.237109 2021] [:error] [pid 39680] [client 10.160.113.208:61211] PHP Notice: Undefined variable: allow_html in /usr/local/nagiosxi/html/includes/utils-status.inc.php on line 235, referer: http://10.x.x.x/nagiosxi/includes/compo ... l&host=abc
[Tue Apr 20 01:42:13.237145 2021] [:error] [pid 39680] [client 10.160.113.208:61211] PHP Notice: Undefined index: problem_acknowledged in /usr/local/nagiosxi/html/includes/utils-status.inc.php on line 183, referer: http://10.x.x.x/nagiosxi/includes/compo ... l&host=abc

What would be the reason and how do we mitigate it.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: error.log file size is increasing

Post by vtrac »

Hi,
I have just asked development team was told that you can actually disable php notices in the php.ini file

I also got the following KB from my boss:
This page has some examples for turning these off.
https://www.php.net/manual/en/function. ... orting.php

// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);
I have tried it on "/etc/php.ini".

I changed my from:

Code: Select all

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
To:

Code: Select all

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT  & ~E_NOTICE
Then restart httpd:

Code: Select all

systemctl restart httpd

Best Regards,
Vinh
sneha.irali
Posts: 141
Joined: Fri Jan 15, 2021 3:56 am

Re: error.log file size is increasing

Post by sneha.irali »

I'm little confused here as the Link you sahred me says as below:

// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

Then what's the pointing is adding E_NOTICE, isnt its just one level of log we are adding. Correct me if my understanding is wrong.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: error.log file size is increasing

Post by vtrac »

Hi,
I asked our developers why they do not defined those variable before using them, so that we don't see those errors in the "error_log" file.

Here's the reply I received:
You can actually disable php notices in the php.ini file as well, we don't do it by default

will look at those though as well
I have test by adding the "~E_NOTICE" to the "error_reporting" inside the "/etc/php.ini" file and looks like it did work.


Best Regards,
Vinh
sneha.irali
Posts: 141
Joined: Fri Jan 15, 2021 3:56 am

Re: error.log file size is increasing

Post by sneha.irali »

Thanks for the info.

However I just want you to know that we have enabled a external REST API Integration to poll the information from Nagios. Can I know if there is any known impact with such kind of integrations additionally I do not find any best practices with REST API Integration, can you help me with it if we have any.
sneha.irali
Posts: 141
Joined: Fri Jan 15, 2021 3:56 am

Re: error.log file size is increasing

Post by sneha.irali »

Also can you confirm if the file size grows post making the below changes:

I have test by adding the "~E_NOTICE" to the "error_reporting" inside the "/etc/php.ini" file and looks like it did work.

and explain me what E_NOTICE mean.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: error.log file size is increasing

Post by vtrac »

Hi,
We as support tech work on technical issues, but not programming related. We will try our best to help ... :-)

Since we work on one issue per ticket, please open another forum ticket for API issue(s).

As to "E_NOTICE", I am NOT a PHP programmer, so I checked with development team regarding the error you have posted in the "error_log" file and was told to add E_NOTICE to the php.ini to turn that off.

I google and found:

Code: Select all

In PHP, a variable that doesn't exist will return null rather than causing an error.
Best Regards,
Vinh
Locked