Use systemd-journald instead of log files

This patch aims to migrate service from usage of regular syslog files
to journald.
By this we mean dropping rsyslog client installation. log_address is set
by default to /dev/log, which is served by journald.

Change-Id: I6dd0d77004394bb1ad674b53538b0679b056bb0f
This commit is contained in:
Dmitriy Rabotyagov 2019-07-19 15:10:46 +03:00
parent 273895816b
commit d0fac1b559
19 changed files with 1 additions and 126 deletions

View File

@ -60,13 +60,6 @@ swift_system_shell: /bin/bash
swift_system_comment: swift system user
swift_system_home_folder: "/var/lib/{{ swift_system_user_name }}"
## Swift Syslog User / Group
swift_syslog_user_name: syslog
# NOTE(hwoarang) The syslog user on openSUSE belongs to the 'users'
# group. There is no dedicated syslog group.
swift_syslog_group_name: "{{ (ansible_pkg_mgr == 'zypper') | ternary ('users', 'syslog') }}"
swift_syslog_log_perms: "0644"
## Auth token
swift_delay_auth_decision: true
@ -319,6 +312,7 @@ swift_pip_packages:
- python-memcached
- python-swiftclient
- swift
- systemd-python
swift_account_replicator_init_overrides: {}
swift_account_replicator_server_init_overrides: {}

View File

@ -23,12 +23,6 @@
listen:
- "venv changed"
- name: Restart rsyslog
service:
name: "rsyslog"
state: "restarted"
enabled: "yes"
- name: Restart rsync service
service:
name: "{{ swift_rsync_service_name }}"

View File

@ -40,7 +40,6 @@ galaxy_info:
- development
- openstack
dependencies:
- rsyslog_client
- role: apt_package_pinning
when:
- ansible_pkg_mgr == 'apt'

View File

@ -38,16 +38,6 @@
notify:
- Restart swift services
- name: Copy swift config
template:
src: "swift-rsyslog.conf.j2"
dest: "/etc/rsyslog.d/49-swift.conf"
owner: "{{ swift_system_user_name }}"
group: "{{ swift_system_group_name }}"
notify:
- Restart swift services
- Restart rsyslog
- name: Enable SSHD
systemd:
name: "{{ swift_sshd }}"

View File

@ -57,32 +57,10 @@
- { path: "/etc/swift/proxy-server" }
- { path: "/etc/swift/scripts" }
- { path: "/etc/swift/ring_build_files" }
- { path: "/openstack/log/{{ inventory_hostname }}", owner: "{{ swift_syslog_user_name }}", group: "{{ swift_syslog_group_name }}" }
- { path: "/var/cache/swift" }
- { path: "{{ swift_system_home_folder }}" }
- { path: "/etc/rsync.d", owner: "root", group: "root" }
- name: Test for log directory or link
shell: |
if [ -h "/var/log/swift" ]; then
chown -h {{ swift_syslog_user_name }}:{{ swift_syslog_group_name }} "/var/log/swift"
chown -R {{ swift_syslog_user_name }}:{{ swift_syslog_group_name }} "$(readlink /var/log/swift)"
else
exit 1
fi
register: log_dir
failed_when: false
changed_when: log_dir.rc != 0
- name: Create swift log dir
file:
path: "/var/log/swift"
state: directory
owner: "{{ swift_syslog_user_name }}"
group: "{{ swift_syslog_group_name }}"
mode: "0755"
when: log_dir.rc != 0
- name: Configure mlocate for cron.daily
template:
src: "mlocate-crond-daily.sh.j2"

View File

@ -10,7 +10,6 @@ bind_ip = {{ swift_replication_address }}
bind_port = {{ swift_account_port }}
devices = {{ swift_vars.mount_point | default(swift.mount_point) }}
workers = {{ swift_account_server_replicator_workers | default(api_threads) }}
log_facility = LOG_LOCAL2
{% set _statsd_host = swift_vars.statsd_host | default(swift.statsd_host | default(statsd_host | default(False))) %}
{% if _statsd_host | bool %}
@ -29,9 +28,5 @@ use = egg:swift#account
replication_server = True
[account-replicator]
log_facility = LOG_LOCAL2
per_diff = 10000
reclaim_age = {{ reclaim_age | default(604800) }}
[account-auditor]
log_facility = LOG_LOCAL2

View File

@ -12,7 +12,6 @@ workers = {{ swift_account_server_workers | default(api_threads) }}
user = {{ swift_system_user_name }}
devices = {{ swift_vars.mount_point | default(swift.mount_point) }}
log_facility = LOG_LOCAL2
{% set _statsd_host = swift_vars.statsd_host | default(swift.statsd_host | default(statsd_host | default(False))) %}
{% if _statsd_host | bool %}
@ -31,29 +30,22 @@ pipeline = healthcheck recon account-server
[app:account-server]
use = egg:swift#account
log_facility = LOG_LOCAL2
[filter:healthcheck]
use = egg:swift#healthcheck
[filter:recon]
use = egg:swift#recon
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock
{% if not swift_dedicated_replication %}
[account-replicator]
log_facility = LOG_LOCAL2
per_diff = 10000
reclaim_age = {{ reclaim_age | default(604800) }}
[account-auditor]
log_facility = LOG_LOCAL2
{% endif %}
[account-reaper]
log_facility = LOG_LOCAL2
delay_reaping = 604800
[filter:xprofile]

View File

@ -5,7 +5,6 @@
use_stderr = False
swift_dir = /etc/swift
user = {{ swift_system_user_name }}
log_facility = LOG_LOCAL3
{% set _statsd_host = swift_vars.statsd_host | default(swift.statsd_host | default(statsd_host | default(False))) %}
{% if _statsd_host | bool %}

View File

@ -10,7 +10,6 @@ bind_ip = {{ swift_replication_address }}
bind_port = {{ swift_container_port }}
devices = {{ swift_vars.mount_point | default(swift.mount_point) }}
workers = {{ swift_server_replicator_workers | default(api_threads) }}
log_facility = LOG_LOCAL3
{% set _statsd_host = swift_vars.statsd_host | default(swift.statsd_host | default(statsd_host | default(False))) %}
{% if _statsd_host | bool %}
@ -29,8 +28,4 @@ use = egg:swift#container
replication_server = True
[container-replicator]
log_facility = LOG_LOCAL3
reclaim_age = {{ reclaim_age | default(604800) }}
[container-auditor]
log_facility = LOG_LOCAL3

View File

@ -12,7 +12,6 @@ workers = {{ swift_container_server_workers | default(api_threads) }}
user = {{ swift_system_user_name }}
devices = {{ swift_vars.mount_point | default(swift.mount_point) }}
log_facility = LOG_LOCAL3
{% set _statsd_host = swift_vars.statsd_host | default(swift.statsd_host | default(statsd_host | default(False))) %}
{% if _statsd_host | bool %}
@ -31,7 +30,6 @@ pipeline = healthcheck recon container-server
[app:container-server]
use = egg:swift#container
log_facility = LOG_LOCAL3
allow_versions = {{ swift_allow_versions }}
[filter:healthcheck]
@ -39,21 +37,15 @@ use = egg:swift#healthcheck
[filter:recon]
use = egg:swift#recon
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock
{% if not swift_dedicated_replication %}
[container-replicator]
log_facility = LOG_LOCAL3
reclaim_age = {{ reclaim_age | default(604800) }}
[container-auditor]
log_facility = LOG_LOCAL3
{% endif %}
[container-updater]
log_facility = LOG_LOCAL3
node_timeout = 15
conn_timeout = 5

View File

@ -2,10 +2,7 @@
[drive-audit]
device_dir = {{ swift_vars.mount_point | default(swift.mount_point) }}
log_facility = LOG_LOCAL0
log_level = INFO
minutes = 60
error_limit = 2
log_file_pattern = /var/log/kern*
regex_pattern_1 = \berror\b.*\b(sd[a-z]+([0-9]+)?)\b
regex_pattern_2 = \b(sd[a-z]+([0-9]+)?)\b.*\berror\b

View File

@ -1,5 +1,4 @@
[DEFAULT]
log_facility = LOG_LOCAL3
{% set _statsd_host = swift_vars.statsd_host | default(swift.statsd_host | default(statsd_host | default(False))) %}
{% if _statsd_host | bool %}
log_statsd_host = {{ _statsd_host }}

View File

@ -5,7 +5,6 @@
use_stderr = False
swift_dir = /etc/swift
user = {{ swift_system_user_name }}
log_facility = LOG_LOCAL4
{% set _statsd_host = swift_vars.statsd_host | default(swift.statsd_host | default(statsd_host | default(False))) %}
{% if _statsd_host | bool %}

View File

@ -10,7 +10,6 @@ bind_ip = {{ swift_replication_address }}
bind_port = {{ swift_object_port }}
devices = {{ swift_vars.mount_point | default(swift.mount_point) }}
workers = {{ swift_object_replicator_workers | default(api_threads) }}
log_facility = LOG_LOCAL4
{% set _statsd_host = swift_vars.statsd_host | default(swift.statsd_host | default(statsd_host | default(False))) %}
{% if _statsd_host | bool %}
@ -29,17 +28,12 @@ use = egg:swift#object
replication_server = True
[object-replicator]
log_facility = LOG_LOCAL4
concurrency = 6
reclaim_age = {{ reclaim_age | default(604800) }}
{% if swift_rsync_module_per_drive %}
rsync_module = {replication_ip}::object_{device}
{% endif %}
[object-auditor]
log_facility = LOG_LOCAL4
[object-reconstructor]
log_facility = LOG_LOCAL4
concurrency = 6
reclaim_age = {{ reclaim_age | default(604800) }}

View File

@ -13,7 +13,6 @@ workers = {{ swift_object_server_workers | default(api_threads) }}
user = {{ swift_system_user_name }}
swift_dir = /etc/swift
devices = {{ swift_vars.mount_point | default(swift.mount_point) }}
log_facility = LOG_LOCAL4
{% set _statsd_host = swift_vars.statsd_host | default(swift.statsd_host | default(statsd_host | default(False))) %}
{% if _statsd_host | bool %}
@ -32,7 +31,6 @@ pipeline = healthcheck recon object-server
[app:object-server]
use = egg:swift#object
log_facility = LOG_LOCAL4
mb_per_sync = 64
[filter:healthcheck]
@ -40,30 +38,23 @@ use = egg:swift#healthcheck
[filter:recon]
use = egg:swift#recon
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock
{% if not swift_dedicated_replication %}
[object-replicator]
log_facility = LOG_LOCAL4
concurrency = 6
reclaim_age = {{ reclaim_age | default(604800) }}
{% if swift_rsync_module_per_drive %}
rsync_module = {replication_ip}::object_{device}
{% endif %}
[object-auditor]
log_facility = LOG_LOCAL4
[object-reconstructor]
log_facility = LOG_LOCAL4
concurrency = 6
reclaim_age = {{ reclaim_age | default(604800) }}
{% endif %}
[object-updater]
log_facility = LOG_LOCAL4
concurrency = 3
concurrency = 3
node_timeout = 60

View File

@ -8,7 +8,6 @@ bind_port = {{ swift_proxy_port }}
workers = {{ swift_proxy_server_workers }}
user = {{ swift_system_user_name }}
log_facility = LOG_LOCAL1
{% set _statsd_host = swift_proxy_vars.statsd_host | default(swift.statsd_host | default(statsd_host | default(False))) %}
{% if _statsd_host | bool %}
@ -27,7 +26,6 @@ use = egg:swift#copy
[app:proxy-server]
use = egg:swift#proxy
log_facility = LOG_LOCAL1
node_timeout = 60
conn_timeout = 3.5
account_autocreate = true

View File

@ -2,7 +2,6 @@
uid = {{ swift_system_user_name }}
gid = {{ swift_system_group_name }}
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
reverse lookup = {{ swift_rsync_reverse_lookup | bool }}
address = {{ swift_replication_address }}

View File

@ -1,26 +0,0 @@
# {{ ansible_managed }}
# Uncomment the following to have a log containing all logs together
#local1,local2,local3,local4.* /var/log/swift/all.log
# Uncomment the following to have hourly proxy logs for stats processing
#$template HourlyProxyLog,"/var/log/swift/hourly/%$YEAR%%$MONTH%%$DAY%%$HOUR%"
#local1.*;local1.!notice ?HourlyProxyLog
$FileCreateMode {{ swift_syslog_log_perms }}
local1.*;local1.!notice /var/log/swift/proxy.log
local1.notice /var/log/swift/proxy-error.log
local1.* ~
local2.*;local2.!notice /var/log/swift/account.log
local2.notice /var/log/swift/account-error.log
local2.* ~
local3.*;local3.!notice /var/log/swift/container.log
local3.notice /var/log/swift/container-error.log
local3.* ~
local4.*;local4.!notice /var/log/swift/object.log
local4.notice /var/log/swift/object-error.log
local4.* ~

View File

@ -43,10 +43,6 @@
src: https://git.openstack.org/openstack/openstack-ansible-os_keystone
scm: git
version: master
- name: rsyslog_client
src: https://git.openstack.org/openstack/openstack-ansible-rsyslog_client
scm: git
version: master
- name: systemd_service
src: https://git.openstack.org/openstack/ansible-role-systemd_service
scm: git