Dropping logrotate.conf for all Openstack aggregate logs
This fix will add a logrotate configuration file for each host including all log files found under /openstack/log. All log files are rotated using copytruncate, so no service needs to be restarted after the rotation. This was implemended to mimic the kilo implementation, hence using the same file name for the logrotate configuration, so it'll updated as part of the kilo upgrade. Change-Id: Ifb180bf5e1dd17c5ee3bdbfda54f7b469d1e4daf Closes-Bug: #1516697
This commit is contained in:
parent
fb439d4ba4
commit
b087695e53
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- hosts: hosts
|
||||
roles:
|
||||
- openstack_host_logrotate
|
|
@ -24,3 +24,4 @@
|
|||
- include: rpc-support-all.yml
|
||||
- include: ../infrastructure/rsyslog-config.yml
|
||||
- include: openstack-service-logrotate.yml
|
||||
- include: openstack-host-logrotate.yml
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Gather files for logrotate
|
||||
shell: |
|
||||
find /openstack/log/*/*.log -type f
|
||||
changed_when: log_files.rc != 0
|
||||
failed_when: false
|
||||
register: log_files
|
||||
|
||||
- name: Write logrotate configuration
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
with_items:
|
||||
- { src: "os_aggregate_storage.j2", dest: "/etc/logrotate.d/os_aggregate_storage" }
|
||||
when: log_files.stdout_lines | count > 0
|
||||
|
||||
- name: Configure logrotate to compress logs by default
|
||||
lineinfile:
|
||||
dest: /etc/logrotate.conf
|
||||
regexp: "^#compress"
|
||||
line: "compress"
|
||||
backrefs: yes
|
|
@ -0,0 +1,14 @@
|
|||
{% for log_file in log_files.stdout_lines %}
|
||||
{{ log_file }}
|
||||
{% endfor %}
|
||||
{
|
||||
copytruncate
|
||||
weekly
|
||||
missingok
|
||||
rotate 14
|
||||
compress
|
||||
dateext
|
||||
maxage 60
|
||||
notifempty
|
||||
nocreate
|
||||
}
|
Loading…
Reference in New Issue