Merge syncing and combining logs into one cronjob
This should prevent race conditions of the form that logs are attempted to be combined while syncing those of individual hosts hasn't finished. Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
a766ec6416
commit
ecd8ab8383
3 changed files with 31 additions and 5 deletions
|
@ -1 +0,0 @@
|
|||
0 06 * * * root /usr/local/bin/combineHttpLogs.sh
|
7
roles/web-data-analysis/files/sync-http-logs-and-merge.sh
Executable file
7
roles/web-data-analysis/files/sync-http-logs-and-merge.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Don't attempt to combine if syncing the individual logs failed.
|
||||
set -e
|
||||
|
||||
/usr/local/bin/sync-http-logs.py
|
||||
/usr/local/bin/combineHttpLogs.sh
|
|
@ -178,13 +178,22 @@
|
|||
- name: install a script to sync httpd logs via cron only on log01
|
||||
copy:
|
||||
src: sync-http-logs.py
|
||||
dest: /etc/cron.daily/sync-http-logs.py
|
||||
dest: /usr/local/bin/sync-http-logs.py
|
||||
mode: 0755
|
||||
when: inventory_hostname.startswith('log01')
|
||||
tags:
|
||||
- web-data
|
||||
- cron
|
||||
|
||||
- name: remove sync-http-logs.py from cron.daily directory
|
||||
file:
|
||||
path: /etc/cron.daily/sync-http-logs.py
|
||||
state: absent
|
||||
when: inventory_hostname.startswith('log01')
|
||||
tags:
|
||||
- web-data
|
||||
- cron
|
||||
|
||||
- name: install awstats package
|
||||
package: state=present name=awstats
|
||||
tags:
|
||||
|
@ -202,8 +211,19 @@
|
|||
- config
|
||||
- web-data
|
||||
|
||||
- name: daily cron job to merge old logs
|
||||
copy: src=combineHttp.cron dest=/etc/cron.d/ mode=0644
|
||||
- name: remove separate daily cron job to merge old logs
|
||||
file:
|
||||
path: /etc/cron.d/combineHttp.cron
|
||||
state: absent
|
||||
tags:
|
||||
- cron
|
||||
- web-data
|
||||
- cron
|
||||
|
||||
- name: install daily cron job to sync and merge log files
|
||||
copy:
|
||||
src: sync-http-logs-and-merge.sh
|
||||
dest: /etc/cron.d
|
||||
mode: 0755
|
||||
tags:
|
||||
- web-data
|
||||
- cron
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue