Hello.

I've been using nagios4 for a long time and for a long time I've been having a problem: when I try to watch alert history for a service I get:
Error: Cannot open log file '/var/spool/nagios/nagios.log' for reading!

In fact:
# ls -l /var/spool/nagios/nagios.log
-rw-r-----  1 nagios nagios 925763 Feb 17 18:17 /var/spool/nagios/nagios.log

Apache won't be able to open it unless it's permission is 644.
I can manually change it and the problem will temporarily go away; alas, the next day, after Nagios rotates the file, it will come back again with 640.

There's a discussion about this at
https://github.com/NagiosEnterprises/nagioscore/issues/303

As you can see the problem is deemed as solved.
The source looks like it's been corrected:
# cd /usr/ports/net-mgmt/nagios4/
# make patch
# less work/nagios-4.5.11/base/logging.c
...
static FILE *open_log_file(void)
{
        int fh;
        struct stat st;

        if(log_fp) /* keep it open unless we rotate */
                return log_fp;

        if ((fh = open(log_file, O_RDWR|O_APPEND|O_CREAT|O_NOFOLLOW, 
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) == -1) {
                if (daemon_mode == FALSE)
                        printf("Warning: Cannot open log file '%s' for 
writing\n", log_file);
                return NULL;
> ...

"S_IROTH" is there, so the file should be created with "r+o" permission. Still this doesn't happen.



Any hint on where to look?

 bye & Thanks
        av.

Reply via email to