Run swift's drive-audit script regularly

This patch adds configuration for swift's drive-audit script with
a cron job to run it hourly at 15 minutes past the hour.

Closes-Bug: 1433619

Change-Id: I1a5cfbfffef007a0d8e9b56dd5936aad7c38916d
This commit is contained in:
Major Hayden 2016-03-10 15:08:34 -06:00
parent a1a7e31f71
commit 5521ce66e7
3 changed files with 34 additions and 0 deletions

View File

@ -265,6 +265,7 @@ swift_account_server_replicator_conf_overrides: {}
swift_container_server_conf_overrides: {} swift_container_server_conf_overrides: {}
swift_container_reconciler_conf_overrides: {} swift_container_reconciler_conf_overrides: {}
swift_container_server_replicator_conf_overrides: {} swift_container_server_replicator_conf_overrides: {}
swift_drive_audit_conf_overrides: {}
swift_object_server_conf_overrides: {} swift_object_server_conf_overrides: {}
swift_object_expirer_conf_overrides: {} swift_object_expirer_conf_overrides: {}
swift_object_server_replicator_conf_overrides: {} swift_object_server_replicator_conf_overrides: {}

View File

@ -131,3 +131,25 @@
when: > when: >
swift.replication_network is not defined or swift.replication_network is not defined or
swift.replication_network == swift.storage_network swift.replication_network == swift.storage_network
- name: Deploy drive-audit configuration file
config_template:
src: drive-audit.conf.j2
dest: /etc/swift/drive-audit.conf
owner: "{{ swift_system_user_name }}"
group: "{{ swift_system_group_name }}"
mode: "0644"
config_overrides: "{{ swift_drive_audit_conf_overrides }}"
config_type: "ini"
tags:
- swift-drive-audit
- name: Create drive-audit cron job
cron:
name: "Run drive-audit script"
job: "{{ swift_venv_bin }}/swift-drive-audit /etc/swift/drive-audit.conf"
minute: 15
cron_file: swift-drive-audit
user: root
tags:
- swift-drive-audit

View File

@ -0,0 +1,11 @@
# {{ ansible_managed }}
[drive-audit]
device_dir = /srv/node
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