Skip to content
Snippets Groups Projects
Commit 70c071c9 authored by ale's avatar ale
Browse files

fix logging to syslog

parent 2f2687d1
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,10 @@ def do_nginx_http_auth(): ...@@ -25,6 +25,10 @@ def do_nginx_http_auth():
app.logger.exception('Unexpected exception in authenticate()') app.logger.exception('Unexpected exception in authenticate()')
abort(500) abort(500)
app.logger.info(
'NGINX_AUTH %s %s %s',
username, service, auth_status)
response = make_response('') response = make_response('')
if auth_status == 'OK': if auth_status == 'OK':
response.headers['Auth-Status'] = 'OK' response.headers['Auth-Status'] = 'OK'
...@@ -36,4 +40,3 @@ def do_nginx_http_auth(): ...@@ -36,4 +40,3 @@ def do_nginx_http_auth():
if n_attempt <= 3: if n_attempt <= 3:
response.headers['Auth-Wait'] = '3' response.headers['Auth-Wait'] = '3'
return response return response
...@@ -89,8 +89,11 @@ def main(): ...@@ -89,8 +89,11 @@ def main():
handler = logging.handlers.SysLogHandler( handler = logging.handlers.SysLogHandler(
address='/dev/log', address='/dev/log',
facility=logging.handlers.SysLogHandler.LOG_DAEMON) facility=logging.handlers.SysLogHandler.LOG_DAEMON)
handler.setLevel(logging.INFO) handler.setFormatter(
logging.getLogger().addHandler(handler) logging.Formatter('auth_server: %(message)s'))
for l in (logging.getLogger(), app_main.app.logger, app_nginx.app.logger):
l.setLevel(logging.INFO)
l.addHandler(handler)
if opts.config: if opts.config:
os.environ['APP_CONFIG'] = opts.config os.environ['APP_CONFIG'] = opts.config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment