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.
|
# not need to be modified by the user.
|
||||||
enable_cors_credential_support: false
|
enable_cors_credential_support: false
|
||||||
|
|
||||||
|
ironic_store_ramdisk_logs: true
|
||||||
# The path to the directory where the deployment logs should be stored when using
|
# The path to the directory where the deployment logs should be stored when using
|
||||||
# local storage.
|
# 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
|
# Set this to true to configure dnsmasq to respond to requests from the
|
||||||
# hosts in your dynamic inventory.
|
# hosts in your dynamic inventory.
|
||||||
@ -195,7 +196,7 @@ inspector_debug: true
|
|||||||
inspector_manage_firewall: false
|
inspector_manage_firewall: false
|
||||||
|
|
||||||
# Set ironic_log_dir to use a non-default log directory for ironic.
|
# 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.
|
# Set inspector_log_dir to use a non-default log directory for inspector.
|
||||||
#inspector_log_dir:
|
#inspector_log_dir:
|
||||||
|
@ -146,16 +146,17 @@
|
|||||||
- name: "Generate ironic Configuration"
|
- name: "Generate ironic Configuration"
|
||||||
include: ironic_config.yml
|
include: ironic_config.yml
|
||||||
|
|
||||||
- name: "Set permissions on directory for the ironic user"
|
- name: "Create the log directories (if requested)"
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0700
|
||||||
owner: "ironic"
|
owner: "ironic"
|
||||||
group: "ironic"
|
group: "ironic"
|
||||||
loop:
|
loop:
|
||||||
- "{{ ironic_log_dir }}"
|
- "{{ ironic_log_dir | default('') }}"
|
||||||
- "{{ ironic_agent_deploy_logs_local_path }}"
|
- "{{ ironic_agent_deploy_logs_local_path | default('') }}"
|
||||||
|
when: item != ""
|
||||||
|
|
||||||
- name: "Create ironic DB Schema"
|
- name: "Create ironic DB Schema"
|
||||||
command: ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema
|
command: ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema
|
||||||
@ -198,29 +199,21 @@
|
|||||||
- "/var/lib/ironic/master_images"
|
- "/var/lib/ironic/master_images"
|
||||||
- "/var/lib/ironic/images"
|
- "/var/lib/ironic/images"
|
||||||
|
|
||||||
- name: "Place ironic services on Debian family"
|
- name: "Place ironic services"
|
||||||
template:
|
template:
|
||||||
src: systemd_template.j2
|
src: systemd_template.j2
|
||||||
dest: "{{ init_dest_dir }}{{ item.service_name }}.service"
|
dest: "{{ init_dest_dir }}{{ item.service_name }}.service"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
loop:
|
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_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
|
service_name: 'ironic-api'
|
||||||
when:
|
username: 'ironic'
|
||||||
- ansible_distribution not in ["CentOS","RedHat"]
|
args: '--config-file /etc/ironic/ironic.conf'
|
||||||
|
- service_path: "{{ ironic_install_prefix.stdout | default('') }}"
|
||||||
- name: "Place ironic services on RedHat family"
|
service_name: 'ironic-conductor'
|
||||||
template:
|
username: 'ironic'
|
||||||
src: systemd_template.j2
|
args: '--config-file /etc/ironic/ironic.conf'
|
||||||
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"]
|
|
||||||
|
|
||||||
- name: "Create and populate /tftpboot"
|
- name: "Create and populate /tftpboot"
|
||||||
include: create_tftpboot.yml
|
include: create_tftpboot.yml
|
||||||
|
@ -33,12 +33,15 @@ auth_strategy = keystone
|
|||||||
auth_strategy = noauth
|
auth_strategy = noauth
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if ironic_log_dir is defined %}
|
{% if ironic_log_dir | default("") != "" %}
|
||||||
log_dir = {{ ironic_log_dir }}
|
log_dir = {{ ironic_log_dir }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if ironic_agent_deploy_logs_local_path | default("") != "/var/log/ironic/deploy" %}
|
|
||||||
[agent]
|
[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 }}
|
deploy_logs_local_path = {{ ironic_agent_deploy_logs_local_path }}
|
||||||
{% endif %}
|
{% 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 cp -a /var/log/* ${LOG_LOCATION}/all/.
|
||||||
sudo chown -R $USER ${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 libvirtd &> ${LOG_LOCATION}/libvirtd.log
|
sudo journalctl -u ironic-api &> ${LOG_LOCATION}/ironic-api.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-conductor &> ${LOG_LOCATION}/ironic-conductor.log
|
sudo journalctl -u ironic-inspector &> ${LOG_LOCATION}/ironic-inspector.log
|
||||||
sudo journalctl -u ironic-inspector &> ${LOG_LOCATION}/ironic-inspector.log
|
sudo journalctl -u dnsmasq &> ${LOG_LOCATION}/dnsmasq.log
|
||||||
sudo journalctl -u dnsmasq &> ${LOG_LOCATION}/dnsmasq.log
|
sudo journalctl -u vbmcd &> ${LOG_LOCATION}/vbmcd.log
|
||||||
sudo journalctl -u vbmcd &> ${LOG_LOCATION}/vbmcd.log
|
sudo journalctl -u uwsgi &> ${LOG_LOCATION}/uwsgi.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
|
|
||||||
|
|
||||||
# Copy PXE information
|
# Copy PXE information
|
||||||
mkdir -p ${LOG_LOCATION}/pxe/
|
mkdir -p ${LOG_LOCATION}/pxe/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user