From 8b1b70c77e8f821c3ef06a7d3cd6f09ce2ae4aa5 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 6 May 2020 10:16:48 -0500 Subject: [PATCH] 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 --- playbooks/roles/nodepool-base/tasks/main.yaml | 8 +++ .../roles/nodepool-builder/files/logging.conf | 55 +++++++++++++++++++ .../roles/nodepool-builder/tasks/main.yaml | 5 ++ .../templates/docker-compose.yaml.j2 | 1 + .../templates/docker-compose.yaml.j2 | 1 + 5 files changed, 70 insertions(+) create mode 100644 playbooks/roles/nodepool-builder/files/logging.conf diff --git a/playbooks/roles/nodepool-base/tasks/main.yaml b/playbooks/roles/nodepool-base/tasks/main.yaml index 1db9045a09..55820437b6 100644 --- a/playbooks/roles/nodepool-base/tasks/main.yaml +++ b/playbooks/roles/nodepool-base/tasks/main.yaml @@ -25,6 +25,14 @@ group: nodepool 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 stat: path: /opt/project-config/nodepool/{{ inventory_hostname }}.yaml diff --git a/playbooks/roles/nodepool-builder/files/logging.conf b/playbooks/roles/nodepool-builder/files/logging.conf new file mode 100644 index 0000000000..9de3dd722d --- /dev/null +++ b/playbooks/roles/nodepool-builder/files/logging.conf @@ -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= diff --git a/playbooks/roles/nodepool-builder/tasks/main.yaml b/playbooks/roles/nodepool-builder/tasks/main.yaml index db821cd593..a65cbcdee3 100644 --- a/playbooks/roles/nodepool-builder/tasks/main.yaml +++ b/playbooks/roles/nodepool-builder/tasks/main.yaml @@ -1,3 +1,8 @@ +- name: Copy logging config + copy: + src: logging.conf + dest: /etc/nodepool/builder-logging.conf + - name: Ensure dib directories file: state: directory diff --git a/playbooks/roles/nodepool-builder/templates/docker-compose.yaml.j2 b/playbooks/roles/nodepool-builder/templates/docker-compose.yaml.j2 index 3594256ed4..41d5eac840 100644 --- a/playbooks/roles/nodepool-builder/templates/docker-compose.yaml.j2 +++ b/playbooks/roles/nodepool-builder/templates/docker-compose.yaml.j2 @@ -5,6 +5,7 @@ services: user: nodepool network_mode: host restart: always + command: nodepool-builder -c /etc/nodepool/nodepool.yaml -l /etc/nodepool/builder-logging.conf privileged: true diff --git a/playbooks/roles/nodepool-launcher/templates/docker-compose.yaml.j2 b/playbooks/roles/nodepool-launcher/templates/docker-compose.yaml.j2 index 95c8d8fce7..1cee0cae60 100644 --- a/playbooks/roles/nodepool-launcher/templates/docker-compose.yaml.j2 +++ b/playbooks/roles/nodepool-launcher/templates/docker-compose.yaml.j2 @@ -5,6 +5,7 @@ services: user: nodepool network_mode: host restart: always + command: nodepool-launcher -c /etc/nodepool/nodepool.yaml -l /etc/nodepool/launcher-logging.conf environment: - DEBUG=1