]> Frank Brehm's Git Trees - salt/states.git/commitdiff
Adding logrotation stuff for apt
authorFrank Brehm <frank@brehm-online.com>
Thu, 17 Nov 2016 10:27:56 +0000 (11:27 +0100)
committerFrank Brehm <frank@brehm-online.com>
Thu, 17 Nov 2016 10:27:56 +0000 (11:27 +0100)
basic/files/logrotate.conf
debian/apt/files/logrotate-apt.conf [new file with mode: 0644]
debian/apt/files/logrotate-aptitude.conf [new file with mode: 0644]
debian/apt/files/logrotate-dpkg.conf [new file with mode: 0644]
debian/apt/init.sls
debian/apt/logrotate.sls [new file with mode: 0644]

index b504c76f13a396cf6e25052c2136ceaca2218251..7b4922a95581c56d55257af25897ca23b1218f1b 100644 (file)
@@ -21,6 +21,8 @@ include /etc/logrotate.d
     monthly
     create 0664 root utmp
     rotate 12
+    dateext
+    dateformat -%Y-%m--%d
     size 4M
 }
 
@@ -29,6 +31,8 @@ include /etc/logrotate.d
     monthly
     create 0660 root utmp
     rotate 12
+    dateext
+    dateformat -%Y-%m--%d
     size 4M
 }
 
diff --git a/debian/apt/files/logrotate-apt.conf b/debian/apt/files/logrotate-apt.conf
new file mode 100644 (file)
index 0000000..493f803
--- /dev/null
@@ -0,0 +1,25 @@
+/var/log/apt/term.log {
+    rotate 12
+    monthly
+    compress
+    missingok
+    notifempty
+    size 1M
+    delaycompress
+    dateext
+    dateformat -%Y-%m--%d
+}
+
+/var/log/apt/history.log {
+    rotate 12
+    monthly
+    compress
+    missingok
+    notifempty
+    size 1M
+    delaycompress
+    dateext
+    dateformat -%Y-%m--%d
+}
+
+# vim: ts=4 filetype=conf et
diff --git a/debian/apt/files/logrotate-aptitude.conf b/debian/apt/files/logrotate-aptitude.conf
new file mode 100644 (file)
index 0000000..eca273f
--- /dev/null
@@ -0,0 +1,14 @@
+/var/log/aptitude {
+    rotate 6
+    monthly
+    compress
+    missingok
+    notifempty
+    size 1M
+    delaycompress
+    dateext
+    dateformat -%Y-%m--%d
+    olddir /var/log/.old
+}
+
+# vim: ts=4 filetype=conf et
diff --git a/debian/apt/files/logrotate-dpkg.conf b/debian/apt/files/logrotate-dpkg.conf
new file mode 100644 (file)
index 0000000..e7adf67
--- /dev/null
@@ -0,0 +1,29 @@
+/var/log/dpkg.log {
+    monthly
+    rotate 12
+    compress
+    delaycompress
+    missingok
+    notifempty
+    size 1M
+    create 644 root root
+    dateext
+    dateformat -%Y-%m--%d
+    olddir /var/log/.old
+}
+
+/var/log/alternatives.log {
+    monthly
+    rotate 12
+    compress
+    delaycompress
+    missingok
+    notifempty
+    size 1M
+    create 644 root root
+    dateext
+    dateformat -%Y-%m--%d
+    olddir /var/log/.old
+}
+
+# vim: ts=4 filetype=conf et
index be321c3a71230449041aaaea4e9bda451145105b..6cdc4c1fb06dd9191f88785b9dc60dc9779ab671 100644 (file)
@@ -85,3 +85,5 @@
       debian_release: {{ debian_release }}
       debian_mirror: {{ debian_mirror }}
 
+include:
+  - debian.apt.logrotate
diff --git a/debian/apt/logrotate.sls b/debian/apt/logrotate.sls
new file mode 100644 (file)
index 0000000..406921d
--- /dev/null
@@ -0,0 +1,53 @@
+
+apt-logrotate:
+  pkg.installed:
+    - name: logrotate
+
+apt-logrotate.d:
+  file.directory:
+    - name: /etc/logrotate.d
+    - require:
+      - pkg: apt-logrotate
+
+apt-log-olddir:
+  file.directory:
+    - name: /var/log/.old
+    - user: root
+    - group: root
+    - dir_mode: 755
+
+apt-logrotate.conf:
+  file.managed:
+    - name: /etc/logrotate.d/apt
+    - source: salt://debian/apt/files/logrotate-apt.conf
+    - user: root
+    - group: root
+    - mode: 644
+    - require:
+      - pkg: apt-logrotate
+      - file: apt-logrotate.d
+
+aptitude-logrotate.conf:
+  file.managed:
+    - name: /etc/logrotate.d/aptitude
+    - source: salt://debian/apt/files/logrotate-aptitude.conf
+    - user: root
+    - group: root
+    - mode: 644
+    - require:
+      - pkg: apt-logrotate
+      - file: apt-logrotate.d
+      - file: apt-log-olddir
+
+dpkg-logrotate.conf:
+  file.managed:
+    - name: /etc/logrotate.d/dpkg
+    - source: salt://debian/apt/files/logrotate-dpkg.conf
+    - user: root
+    - group: root
+    - mode: 644
+    - require:
+      - pkg: apt-logrotate
+      - file: apt-logrotate.d
+      - file: apt-log-olddir
+