LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   application log file suddenly unwriteable by Apache (https://www.linuxquestions.org/questions/linux-server-73/application-log-file-suddenly-unwriteable-by-apache-659777/)

vtbludgeon 08-01-2008 11:27 AM

application log file suddenly unwriteable by Apache
 
I am running a PHP/Mysql Zend Framework 1.5.2 application on CentOS.

When php/apache tries to open the application's log file for appending, the logging component Zend_Log throws an exception '"/var/log/webapp/interp_requests.test.log" cannot be opened with mode "a"'

Here's what's odd: The file, and its ownership, and its permissions, AFAIK are today exactly the same as what they were yesterday and it was working just fine. I.e.:

Code:

[david@interps2 webapp]$ ls -ld /var/log/webapp
drwxr-xr-x 2 apache apache 4096 Aug  1 09:12 /var/log/webapp
[david@interps2 webapp]$ ls -ld /var/log/webapp/*
-rw-r--r-- 1 apache apache 46759 Jul 31 17:45 /var/log/webapp/interp_requests.test.log

and I did not touch anything in the interim. My yum.log tells me some things were updated yesterday, maybe that's related to my issue. I have had problems in the past with selinux doing its job against my will, but

Code:

sudo grep -i selinux /var/log/messages
does not say anything about apache or httpd except this, from several days ago:
Code:

Jul 27 04:02:20 interps2 setroubleshoot: SELinux is preventing the /usr/sbin/httpd from using
potentially mislabeled files socket:[390995] (rpm_var_lib_t).
For complete SELinux messages. run sealert -l 6012850a-b9b1-4db6-a5b2-ee689f96dbfc

and I don't know whether that is relevant. Nonetheless, when I go

Code:

[root@interps2 log]# /usr/bin/sealert -l 6012850a-b9b1-4db6-a5b2-ee689f96dbfc
I get
Code:

failed to connect to server: 'NoneType' object has no attribute 'format'
So.... any ideas?

Gratefully,

unSpawn 08-02-2008 12:18 PM

Quote:

Originally Posted by vtbludgeon (Post 3233393)
cannot be opened with mode "a"'

Dunno. "mode a" sounds like "append"?


Quote:

Originally Posted by vtbludgeon (Post 3233393)
My yum.log tells me some things were updated yesterday, maybe that's related to my issue.

Please check. You can 'rpm --last|head -30' if you know it was thirty or less upgrades, else check your yum.log.


Quote:

Originally Posted by vtbludgeon (Post 3233393)
I have had problems in the past with selinux doing its job against my will

No, you definately wanted it but you didn't *know* you wanted it :-]


Quote:

Originally Posted by vtbludgeon (Post 3233393)
failed to connect to server: 'NoneType' object has no attribute 'format'

Have a look if restarting the (nscd, auditd and) setroubleshootd daemon helps you get access again. If any of those won't come up again check the logs. First thing comes to mind would be a Python issue.

vtbludgeon 09-02-2008 10:20 AM

Quote:

Originally Posted by unSpawn (Post 3234440)
Dunno. "mode a" sounds like "append"?

Yeah, that's just PHP-speak for opening a file for appending.

Quote:

Originally Posted by unSpawn (Post 3234440)
Have a look if restarting the (nscd, auditd and) setroubleshootd daemon helps you get access again. If any of those won't come up again check the logs. First thing comes to mind would be a Python issue.

You're the man! '/etc/init.d/nscd restart' reported that it wasn't running in the first place. This is pretty much black magic to me but I rebooted all the daemons you said and then I was able to reproduce the error, grep the logs, run the selinux stuff, restorecon on the file in question, and get back on the road again.

Thank you!


All times are GMT -5. The time now is 03:02 PM.