Make ironic logging more in line with other services.
Currently ironic logs into files, other services - into journald. Ramdisk logs are for some reason stored with data rather than in /var/log. This change makes all services log into journald and changes to standard paths for ramdisk logs (making them available in the CI as a side effect). Change-Id: I8b3c7750596602c2609798ffbb7e274e2c18b40f
This commit is contained in:
parent
1606aad1a4
commit
33a63bc0da
@ -172,9 +172,10 @@ cors_allowed_origin: "http://localhost:8000"
|
||||
# not need to be modified by the user.
|
||||
enable_cors_credential_support: false
|
||||
|
||||
ironic_store_ramdisk_logs: true
|
||||
# The path to the directory where the deployment logs should be stored when using
|
||||
# local storage.
|
||||
ironic_agent_deploy_logs_local_path: "{{ '/'.join([ironic_log_dir, 'deploy']) }}"
|
||||
ironic_agent_deploy_logs_local_path: /var/log/ironic/deploy
|
||||
|
||||
# Set this to true to configure dnsmasq to respond to requests from the
|
||||
# hosts in your dynamic inventory.
|
||||
@ -195,7 +196,7 @@ inspector_debug: true
|
||||
inspector_manage_firewall: false
|
||||
|
||||
# Set ironic_log_dir to use a non-default log directory for ironic.
|
||||
ironic_log_dir: /var/log/ironic
|
||||
#ironic_log_dir: /var/log/ironic
|
||||
|
||||
# Set inspector_log_dir to use a non-default log directory for inspector.
|
||||
#inspector_log_dir:
|
||||
|
@ -146,16 +146,17 @@
|
||||
- name: "Generate ironic Configuration"
|
||||
include: ironic_config.yml
|
||||
|
||||
- name: "Set permissions on directory for the ironic user"
|
||||
- name: "Create the log directories (if requested)"
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
mode: 0700
|
||||
owner: "ironic"
|
||||
group: "ironic"
|
||||
loop:
|
||||
- "{{ ironic_log_dir }}"
|
||||
- "{{ ironic_agent_deploy_logs_local_path }}"
|
||||
- "{{ ironic_log_dir | default('') }}"
|
||||
- "{{ ironic_agent_deploy_logs_local_path | default('') }}"
|
||||
when: item != ""
|
||||
|
||||
- name: "Create ironic DB Schema"
|
||||
command: ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema
|
||||
@ -198,29 +199,21 @@
|
||||
- "/var/lib/ironic/master_images"
|
||||
- "/var/lib/ironic/images"
|
||||
|
||||
- name: "Place ironic services on Debian family"
|
||||
- name: "Place ironic services"
|
||||
template:
|
||||
src: systemd_template.j2
|
||||
dest: "{{ init_dest_dir }}{{ item.service_name }}.service"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
loop:
|
||||
- { service_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-api', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
|
||||
- { service_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
|
||||
when:
|
||||
- ansible_distribution not in ["CentOS","RedHat"]
|
||||
|
||||
- name: "Place ironic services on RedHat family"
|
||||
template:
|
||||
src: systemd_template.j2
|
||||
dest: "{{ init_dest_dir }}{{ item.service_name }}.service"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
loop:
|
||||
- { service_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-api', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf --log-file {{ ironic_log_dir }}/ironic-api.log'}
|
||||
- { service_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf --log-file {{ ironic_log_dir }}/ironic-conductor.log'}
|
||||
when:
|
||||
- ansible_distribution in ["CentOS","RedHat"]
|
||||
- service_path: "{{ ironic_install_prefix.stdout | default('') }}"
|
||||
service_name: 'ironic-api'
|
||||
username: 'ironic'
|
||||
args: '--config-file /etc/ironic/ironic.conf'
|
||||
- service_path: "{{ ironic_install_prefix.stdout | default('') }}"
|
||||
service_name: 'ironic-conductor'
|
||||
username: 'ironic'
|
||||
args: '--config-file /etc/ironic/ironic.conf'
|
||||
|
||||
- name: "Create and populate /tftpboot"
|
||||
include: create_tftpboot.yml
|
||||
|
@ -33,12 +33,15 @@ auth_strategy = keystone
|
||||
auth_strategy = noauth
|
||||
{% endif %}
|
||||
|
||||
{% if ironic_log_dir is defined %}
|
||||
{% if ironic_log_dir | default("") != "" %}
|
||||
log_dir = {{ ironic_log_dir }}
|
||||
{% endif %}
|
||||
|
||||
{% if ironic_agent_deploy_logs_local_path | default("") != "/var/log/ironic/deploy" %}
|
||||
[agent]
|
||||
{% if ironic_store_ramdisk_logs | bool %}
|
||||
deploy_logs_collect = always
|
||||
{% endif %}
|
||||
{% if ironic_agent_deploy_logs_local_path | default("") != "" %}
|
||||
deploy_logs_local_path = {{ ironic_agent_deploy_logs_local_path }}
|
||||
{% endif %}
|
||||
|
||||
|
17
releasenotes/notes/logging-bcc7d552944c94e4.yaml
Normal file
17
releasenotes/notes/logging-bcc7d552944c94e4.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
All services now use *journald* logging by default, ``ironic-api.log`` and
|
||||
``ironic-conductor.log`` are no longer populated. Use ``ironic_log_dir``
|
||||
and ``inspector_log_dir`` to override.
|
||||
- |
|
||||
The ramdisk logs for deploy/cleaning are now by default stored in
|
||||
``/var/log/ironic/deploy``.
|
||||
security:
|
||||
- |
|
||||
Uses mode 0700 for the ironic log directories to prevent them from being
|
||||
world readable.
|
||||
features:
|
||||
- |
|
||||
Deploy/cleaning ramdisk logs are now always stored by default, use
|
||||
``ironic_store_ramdisk_logs`` to override.
|
@ -56,19 +56,13 @@ mkdir -p ${LOG_LOCATION}/all
|
||||
sudo cp -a /var/log/* ${LOG_LOCATION}/all/.
|
||||
sudo chown -R $USER ${LOG_LOCATION}/all
|
||||
|
||||
if $(journalctl --version &>/dev/null); then
|
||||
sudo journalctl -u libvirtd &> ${LOG_LOCATION}/libvirtd.log
|
||||
sudo journalctl -u ironic-api &> ${LOG_LOCATION}/ironic-api.log
|
||||
sudo journalctl -u ironic-conductor &> ${LOG_LOCATION}/ironic-conductor.log
|
||||
sudo journalctl -u ironic-inspector &> ${LOG_LOCATION}/ironic-inspector.log
|
||||
sudo journalctl -u dnsmasq &> ${LOG_LOCATION}/dnsmasq.log
|
||||
sudo journalctl -u vbmcd &> ${LOG_LOCATION}/vbmcd.log
|
||||
else
|
||||
sudo cp /var/log/upstart/ironic-api.log ${LOG_LOCATION}/
|
||||
sudo cp /var/log/upstart/ironic-conductor.log ${LOG_LOCATION}/
|
||||
sudo cp /var/log/upstart/ironic-inspector.log ${LOG_LOCATION}/
|
||||
sudo cp /var/log/upstart/libvirtd.log ${LOG_LOCATION}/
|
||||
fi
|
||||
sudo journalctl -u libvirtd &> ${LOG_LOCATION}/libvirtd.log
|
||||
sudo journalctl -u ironic-api &> ${LOG_LOCATION}/ironic-api.log
|
||||
sudo journalctl -u ironic-conductor &> ${LOG_LOCATION}/ironic-conductor.log
|
||||
sudo journalctl -u ironic-inspector &> ${LOG_LOCATION}/ironic-inspector.log
|
||||
sudo journalctl -u dnsmasq &> ${LOG_LOCATION}/dnsmasq.log
|
||||
sudo journalctl -u vbmcd &> ${LOG_LOCATION}/vbmcd.log
|
||||
sudo journalctl -u uwsgi &> ${LOG_LOCATION}/uwsgi.log
|
||||
|
||||
# Copy PXE information
|
||||
mkdir -p ${LOG_LOCATION}/pxe/
|
||||
|
Loading…
x
Reference in New Issue
Block a user