Configure nodepool to use logging config

We have a logging config to log to /var/log/nodepool but we weren't
using it. Start using it.

Add logging config to nodepool-builder

We should log nodepool builder to /var/log/nodepool too.

Change-Id: I6e7196dc12e8c1bfc54274432b94cf53629bdf3d
This commit is contained in:
Monty Taylor 2020-05-06 10:16:48 -05:00
parent e56cbdcee3
commit 8b1b70c77e
5 changed files with 70 additions and 0 deletions

View File

@ -25,6 +25,14 @@
group: nodepool group: nodepool
mode: 0755 mode: 0755
- name: Create nodepool log dir
file:
name: /var/log/nodepool
state: directory
owner: nodepool
group: nodepool
mode: 0755
- name: Look for a host specific config file - name: Look for a host specific config file
stat: stat:
path: /opt/project-config/nodepool/{{ inventory_hostname }}.yaml path: /opt/project-config/nodepool/{{ inventory_hostname }}.yaml

View File

@ -0,0 +1,55 @@
[loggers]
keys=root,nodepool,requests,openstack,kazoo
[handlers]
keys=console,debug,normal
[formatters]
keys=simple
[logger_root]
level=WARNING
handlers=console
[logger_requests]
level=WARNING
handlers=debug,normal
qualname=requests
[logger_openstack]
level=WARNING
handlers=debug,normal
qualname=openstack
[logger_nodepool]
level=DEBUG
handlers=debug,normal
qualname=nodepool
[logger_kazoo]
level=INFO
handlers=debug,normal
qualname=kazoo
propagate=0
[handler_console]
level=WARNING
class=StreamHandler
formatter=simple
args=(sys.stdout,)
[handler_debug]
level=DEBUG
class=logging.handlers.TimedRotatingFileHandler
formatter=simple
args=('/var/log/nodepool/builder-debug.log', 'H', 8, 30,)
[handler_normal]
level=INFO
class=logging.handlers.TimedRotatingFileHandler
formatter=simple
args=('/var/log/nodepool/nodepool-builder.log', 'H', 8, 30,)
[formatter_simple]
format=%(asctime)s %(levelname)s %(name)s: %(message)s
datefmt=

View File

@ -1,3 +1,8 @@
- name: Copy logging config
copy:
src: logging.conf
dest: /etc/nodepool/builder-logging.conf
- name: Ensure dib directories - name: Ensure dib directories
file: file:
state: directory state: directory

View File

@ -5,6 +5,7 @@ services:
user: nodepool user: nodepool
network_mode: host network_mode: host
restart: always restart: always
command: nodepool-builder -c /etc/nodepool/nodepool.yaml -l /etc/nodepool/builder-logging.conf
privileged: true privileged: true

View File

@ -5,6 +5,7 @@ services:
user: nodepool user: nodepool
network_mode: host network_mode: host
restart: always restart: always
command: nodepool-launcher -c /etc/nodepool/nodepool.yaml -l /etc/nodepool/launcher-logging.conf
environment: environment:
- DEBUG=1 - DEBUG=1