Skip to content

Commit 064fa0d

Browse files
author
Christopher M. Neill
committed
the script chucks anything > 72 hours and compresses any uncompressed rotated log it sees in /var/log.
1 parent e0c20ae commit 064fa0d

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

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 '*.log.*z' -mtime +3 -exec rm -f {} \;
4+
bzip2 -9 /var/log/*.log.+([0-9])
5+

ansible/roles/loggly/tasks/main.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,31 @@
88
owner=root
99
group=root
1010

11+
- name: create ubuntu bindir
12+
tags: loggly
13+
file:
14+
path=/home/ubuntu/bin
15+
state=directory
16+
owner=ubuntu
17+
group=ubuntu
18+
mode=0755
19+
20+
- name: copy rotate util script
21+
tags: loggly
22+
sudo: yes
23+
file:
24+
src=rotate-logs.sh
25+
dest=/home/ubuntu/bin/rotate-logs.sh
26+
owner=ubuntu
27+
group=ubuntu
28+
mode=0755
29+
1130
- name: copy app config
1231
tags: loggly
1332
sudo: yes
1433
template:
15-
src=21-filemonitoring-app.conf.j2
16-
dest=/etc/rsyslog.d/21-filemonitoring-{{ name }}.conf
34+
src=20-output-syslog.conf.j2
35+
dest=/etc/rsyslog.d/20-output-{{ name }}.conf
1736
owner=root
1837
group=root
1938

0 commit comments

Comments
 (0)