Skip to content

Commit b81bd3c

Browse files
author
Christopher M. Neill
committed
Will override commit from Bryan.
1 parent 4a9d50a commit b81bd3c

4 files changed

Lines changed: 12 additions & 16 deletions

File tree

ansible/roles/loggly/files/rotate-logs.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

ansible/roles/loggly/tasks/main.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,19 @@
88
owner=root
99
group=root
1010

11-
- name: create ubuntu bindir
11+
- name: create runnable bin directory
1212
tags: loggly
1313
file:
14-
path=/home/ubuntu/bin
14+
path=/opt/runnable/bin
1515
state=directory
16-
owner=ubuntu
17-
group=ubuntu
1816
mode=0755
1917

2018
- name: copy rotate util script
2119
tags: loggly
2220
sudo: yes
23-
file:
24-
src=rotate-logs.sh
25-
dest=/home/ubuntu/bin/rotate-logs.sh
26-
owner=ubuntu
27-
group=ubuntu
21+
template:
22+
src=rotate-logs.sh.j2
23+
dest=/opt/runnable/bin/rotate-{{ name }}-logs.sh
2824
mode=0755
2925

3026
- name: remove file monitor config
@@ -39,7 +35,7 @@
3935
sudo: yes
4036
template:
4137
src=21-output-syslog.conf.j2
42-
dest=/etc/rsyslog.d/21-output-{{ name }}.conf
38+
dest=/etc/rsyslog.d/21-rotated-{{ name }}.conf
4339
owner=root
4440
group=root
4541

ansible/roles/loggly/templates/21-output-syslog.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ $PrivDropToGroup adm
33

44
# start log rotation via outchannel
55
# outchannel definition
6-
$outchannel log_rotation,/var/log/{{ name }}.log, 52428800,/home/ubuntu/bin/rotate-logs.sh
6+
$outchannel log_rotation,/var/log/{{ name }}.log, 52428800,/opt/runnable/bin/rotate-{{ name }}-logs.sh
77
# activate the channel and log everything to it
88
local7.* :omfile:$log_rotation
99
# end log rotation via outchannel
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
find /var/log -type f -name '{{ name }}.*.bz2' -mtime +3 -exec rm -f {} \;
4+
bzip2 -9 /var/log/{{ name }}.log.+([0-9])
5+

0 commit comments

Comments
 (0)