Unable to start HTTPD. Getting: (13)Permission denied: httpd: could not open error log file /opt/graphite/storage/log/webapp/error.log.

Asked by Kent Tran

I'm running Fedora 16.

Installed Graphite 0.9.9.
Check-dependencies.py --> indicates "All necessary and optional dependencies are met"

Copied examples-graphite-vhost.conf to /etc/httd/conf.d/vhost.conf
Changed two lines:
WSGISocketPrefix run/wsgi
Alias /media/ "/usr/lib/python2.7/site-packages/django/contrib/admin/media/"

Unfortunately, when I tried starting HTTPD, it gives error:
"Getting: (13)Permission denied: httpd: could not open error log file /opt/graphite/storage/log/webapp/error.log"

I even 'chmod -R 777 opt/" but no joy. I also changed httpd.conf user/group to 'root' just for testing purposes, but no joy.

Any ideas?

Thanks in advance for all the help.

Kent

Question information

Language:
English Edit question
Status:
Solved
For:
Graphite Edit question
Assignee:
No assignee Edit question
Solved by:
Kent Tran
Solved:
Last query:
Last reply:
Revision history for this message
Daniel Lawrence (dannyla) said :
#1

Hello,

This error occurs when the user that is running the wsgi script is not the owner of the /opt/graphite/storage/log/webapp/error.log file, I was able to replicate what looks to be the same error and fix it by changing the ownership of the /opt/graphite/storage/log/webapp/error.log file to www-data ( as that is the user that is running my apache2 process ).

from /opt/graphite/storage/log/webapp/error.log
mod_wsgi (pid=9365): Target WSGI script '/opt/graphite/conf/graphite.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=9365): Exception occurred processing WSGI script '/opt/graphite/conf/graphite.wsgi'.
Traceback (most recent call last):
  File "/opt/graphite/conf/graphite.wsgi", line 14, in <module>
    from graphite.logger import log
  File "/opt/graphite/webapp/graphite/logger.py", line 75, in <module>
    log = GraphiteLogger() # import-shared logger instance
  File "/opt/graphite/webapp/graphite/logger.py", line 40, in __init__
    self.infoHandler = Rotater(self.infoLogFile,when="midnight",backupCount=1)
  File "/usr/lib/python2.7/logging/handlers.py", line 171, in __init__
    BaseRotatingHandler.__init__(self, filename, 'a', encoding, delay)
  File "/usr/lib/python2.7/logging/handlers.py", line 65, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/__init__.py", line 897, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 916, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/opt/graphite/storage/log/webapp/info.log'

$ ps -ef | grep 9365
www-data 9365 9357 0 19:52 ? 00:00:00 (wsgi:graphite) -k start

The Fix
$ sudo chown www-data /opt/graphite/storage/log/webapp/*.log

Let me know if that fixes the issue.

Revision history for this message
Kent Tran (ktran) said :
#2

Hi Daniel,

Yes! This fixed the issue. Thanks!!

Kent