Using rsyslog for logging from Galaxy
Hi all, For our production server we are using rsyslog for centralised logging, http://www.rsyslog.com/ Galaxy is using "import logging" which can output to rsyslog, using SysLogHandler rather than StreamHandler or FileHandler. Based on grep'ing the source code Galaxy doesn't support this yet. I could probably add it but it isn't clear to me where this would be done... functions configure_logging() in lib/galaxy/config.py and in lib/galaxy/webapps/community/config.py look like strong possibilities but both allow for some global_conf_parser override (and I'm not sure what that does). Has anyone looked at modifying this area before, or could offer some tips? Thanks, Peter
Peter wrote:
Hi all,
For our production server we are using rsyslog for centralised logging, http://www.rsyslog.com/
Galaxy is using "import logging" which can output to rsyslog, using SysLogHandler rather than StreamHandler or FileHandler. Based on grep'ing the source code Galaxy doesn't support this yet. I could probably add it but it isn't clear to me where this would be done... functions configure_logging() in lib/galaxy/config.py and in lib/galaxy/webapps/community/config.py look like strong possibilities but both allow for some global_conf_parser override (and I'm not sure what that does).
Has anyone looked at modifying this area before, or could offer some tips?
Hi Peter, You can actually override the logging directly in universe_wsgi.ini. Create some new sections that look something like these: [loggers] keys=root,paste [handlers] keys=syslog [formatters] keys=default [logger_root] level=DEBUG handlers=syslog [logger_paste] qualname=paste.httpserver.ThreadPool level=WARN handlers=syslog [handler_syslog] class=logging.handlers.SysLogHandler level=NOTSET formatter=default args=(('syslog_server_ip',514),'syslog_facility') [formatter_default] format=%(name)s %(levelname)s %(asctime)s %(message)s --nate
Thanks,
Peter _______________________________________________ galaxy-dev mailing list galaxy-dev@lists.bx.psu.edu http://lists.bx.psu.edu/listinfo/galaxy-dev
On Thu, Sep 30, 2010 at 5:03 PM, Nate Coraor <nate@bx.psu.edu> wrote:
Peter wrote:
Hi all,
For our production server we are using rsyslog for centralised logging, http://www.rsyslog.com/
Galaxy is using "import logging" which can output to rsyslog, using SysLogHandler rather than StreamHandler or FileHandler. Based on grep'ing the source code Galaxy doesn't support this yet. I could probably add it but it isn't clear to me where this would be done... functions configure_logging() in lib/galaxy/config.py and in lib/galaxy/webapps/community/config.py look like strong possibilities but both allow for some global_conf_parser override (and I'm not sure what that does).
Has anyone looked at modifying this area before, or could offer some tips?
Hi Peter,
You can actually override the logging directly in universe_wsgi.ini. Create some new sections that look something like these:
[loggers] keys=root,paste
[handlers] keys=syslog
[formatters] keys=default
[logger_root] level=DEBUG handlers=syslog
[logger_paste] qualname=paste.httpserver.ThreadPool level=WARN handlers=syslog
[handler_syslog] class=logging.handlers.SysLogHandler level=NOTSET formatter=default args=(('syslog_server_ip',514),'syslog_facility')
[formatter_default] format=%(name)s %(levelname)s %(asctime)s %(message)s
--nate
Excellent - that should be perfect. This must be handled by the global_conf_parser override code which I hadn't traced. Thanks. Peter P.S. Is this on the wiki somewhere?
Nate, I've tried that as is, and got stuck: Traceback (most recent call last): File "/opt/galaxy-dist/lib/galaxy/web/buildapp.py", line 82, in app_factory app = UniverseApplication( global_conf = global_conf, **kwargs ) File "/opt/galaxy-dist/lib/galaxy/app.py", line 21, in __init__ self.datatypes_registry = galaxy.datatypes.registry.Registry( self.config.root, self.config.datatypes_config ) File "/opt/galaxy-dist/lib/galaxy/datatypes/registry.py", line 36, in __init__ self.log.debug( 'Loading datatypes from %s' % config ) File "/usr/lib64/python2.4/logging/__init__.py", line 955, in debug apply(self._log, (DEBUG, msg, args), kwargs) File "/usr/lib64/python2.4/logging/__init__.py", line 1079, in _log self.handle(record) File "/usr/lib64/python2.4/logging/__init__.py", line 1089, in handle self.callHandlers(record) File "/usr/lib64/python2.4/logging/__init__.py", line 1126, in callHandlers hdlr.handle(record) File "/usr/lib64/python2.4/logging/__init__.py", line 642, in handle self.emit(record) File "/usr/lib64/python2.4/logging/handlers.py", line 670, in emit self.mapPriority(record.levelname)), File "/usr/lib64/python2.4/logging/handlers.py", line 633, in encodePriority facility = self.facility_names[facility] KeyError: 'syslog_facility' Any tips? I figured out Galaxy is using PastScript for this, right?: http://pythonpaste.org/script Looking at the docstring for logging.handlers.SysLogHandler I have tried several variations without success. Thanks, Peter
Peter wrote:
Nate,
I've tried that as is, and got stuck:
Traceback (most recent call last): File "/opt/galaxy-dist/lib/galaxy/web/buildapp.py", line 82, in app_factory app = UniverseApplication( global_conf = global_conf, **kwargs ) File "/opt/galaxy-dist/lib/galaxy/app.py", line 21, in __init__ self.datatypes_registry = galaxy.datatypes.registry.Registry( self.config.root, self.config.datatypes_config ) File "/opt/galaxy-dist/lib/galaxy/datatypes/registry.py", line 36, in __init__ self.log.debug( 'Loading datatypes from %s' % config ) File "/usr/lib64/python2.4/logging/__init__.py", line 955, in debug apply(self._log, (DEBUG, msg, args), kwargs) File "/usr/lib64/python2.4/logging/__init__.py", line 1079, in _log self.handle(record) File "/usr/lib64/python2.4/logging/__init__.py", line 1089, in handle self.callHandlers(record) File "/usr/lib64/python2.4/logging/__init__.py", line 1126, in callHandlers hdlr.handle(record) File "/usr/lib64/python2.4/logging/__init__.py", line 642, in handle self.emit(record) File "/usr/lib64/python2.4/logging/handlers.py", line 670, in emit self.mapPriority(record.levelname)), File "/usr/lib64/python2.4/logging/handlers.py", line 633, in encodePriority facility = self.facility_names[facility] KeyError: 'syslog_facility'
Any tips?
I figured out Galaxy is using PastScript for this, right?: http://pythonpaste.org/script
Yup.
Looking at the docstring for logging.handlers.SysLogHandler I have tried several variations without success.
The values in the 'args' key under [handler_syslog] should be replaced with values applicable to your local site. For example, if you wanted to log to the local syslog, facility 'local6', you'd specify the following: args=('/dev/log','local6') --nate
Thanks,
Peter
On Fri, Oct 1, 2010 at 6:06 PM, Nate Coraor <nate@bx.psu.edu> wrote:
Any tips?
I figured out Galaxy is using PastScript for this, right?: http://pythonpaste.org/script
Yup.
Looking at the docstring for logging.handlers.SysLogHandler I have tried several variations without success.
The values in the 'args' key under [handler_syslog] should be replaced with values applicable to your local site. For example, if you wanted to log to the local syslog, facility 'local6', you'd specify the following:
I got there in the end, the following seems to be working locally: ... [handler_syslog] class=logging.handlers.SysLogHandler level=DEBUG formatter=default args=('/dev/log',handlers.SysLogHandler.LOG_SYSLOG) Interestingly from standalone Python I didn't need to give a facility argument, handler = logging.handlers.SysLogHandler(address='/dev/log') Thanks, Peter
participants (2)
-
Nate Coraor
-
Peter