Logging to syslog not working

Asked by Jesse Pretorius

I want keystone to log to syslog, but it only seems to be sending log information to the log file instead. I figure that this may have something to do with the way the log handling is configured, but I can't figure out what I'm missing or doing wrong. Can someone please assist?

Extract of /etc/keystone/keystone.conf:

[DEFAULT]
verbose = True
debug = True
log_config = /etc/keystone/logging.conf
use_syslog = True
syslog_log_facility = LOG_USER

Full content of /etc/keystone/logging.conf:
[loggers]
keys=root,keystone,combined

[formatters]
keys=normal,normal_with_name,debug

[handlers]
keys=production,file,devel

[logger_root]
level=DEBUG
handlers=file

[logger_keystone]
level=DEBUG
handlers=file
qualname=keystone

[logger_combined]
level=DEBUG
handlers=file
qualname=keystone-combined

[handler_production]
class=handlers.SysLogHandler
level=DEBUG
formatter=normal_with_name
#args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
args=(('10.12.12.28', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)

[handler_file]
class=FileHandler
level=DEBUG
formatter=normal_with_name
args=('/var/log/keystone/keystone.log', 'w')

[handler_devel]
class=StreamHandler
level=DEBUG
formatter=debug
args=(sys.stdout,)

[formatter_normal]
format=%(asctime)s %(levelname)s %(message)s

[formatter_normal_with_name]
format=(%(name)s): %(asctime)s %(levelname)s %(message)s

[formatter_debug]
format=(%(name)s): %(asctime)s %(levelname)s %(module)s %(funcName)s %(message)s

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Identity (keystone) Edit question
Assignee:
No assignee Edit question
Solved by:
Jesse Pretorius
Solved:
Last query:
Last reply:
Revision history for this message
Andy McCrae (andrew-mccrae) said :
#1

The settings look to be ok, since LOG_USER should be a syslog facility.
What settings do you have in your syslog conf, e.g. /etc/rsyslog.d/*.conf or /etc/syslog.conf etc.

You should have a line user.* /var/log/keystone.log - along those lines

Revision history for this message
Jesse Pretorius (jesse-pretorius) said :
#2

/etc/rsyslog.conf contains the following to allow any process on the box to send to its listening address via UDP:
$ModLoad imudp
$UDPServerAddress 10.12.12.28
$UDPServerRun 514
$AllowedSender UDP, 10.12.12.28

/etc/rsyslog.d/50-default.conf contains the following to log locally:
*.*;auth,authpriv.none -/var/log/syslog
user.* -/var/log/user.log

/etc/rsyslog.d/remote.conf sends all syslog facility logs to a remote server:
*.* @10.12.12.20:514

I don't think that this has anything to do with the syslog configuration - glance is configured to log to syslog and is working. Glance's config does not have a log_config parameter though, and that's the only difference I'm seeing here.

In /etc/keystone/logging.conf reference is made to the handlers (production,file,devel) and loggers (root,keystone,combined). All loggers are referring to the 'file' handler, and none to the 'production' handler which is what refers to syslog. I suspect that this is the issue but I cannot find a sample configuration where it shows me how to change this successfully.

Which of the loggers (root,keystone,combined) do I need to change? Is the logger determined by the userid that the service runs under, or some other means? I've dug around - even in the python logger documentation but I can't make head or tail of this yet.

Revision history for this message
Jesse Pretorius (jesse-pretorius) said :
#3

In /etc/keystone/logging.conf I changed logger_keystone to have handlers=production and now it's working.