-
Karel Koci authoredKarel Koci authored
0014-syslog-ng-rotate-default-log-with-logrotate.patch 2.27 KiB
From ae1ed2e64abe361b582aee8db7236da32193374f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= <karel.koci@nic.cz>
Date: Mon, 15 Apr 2019 15:31:04 +0200
Subject: [PATCH] syslog-ng: rotate default log with logrotate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This adds dependency on logrotate and configuration for logrotate. It is
set to rotate log file weekly (default from logrotate) or if it exceeds
10M. Number of preserved logs is limited to 4 from default logrotate
configuration so this means that at most four weeks of backlog or 40M is
preserved.
Signed-off-by: Karel Kočí <karel.koci@nic.cz>
---
admin/syslog-ng/Makefile | 6 ++++--
admin/syslog-ng/files/logrotate.conf | 8 ++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
create mode 100644 admin/syslog-ng/files/logrotate.conf
diff --git a/admin/syslog-ng/Makefile b/admin/syslog-ng/Makefile
index 1114724..ac1d1c6 100644
--- a/admin/syslog-ng/Makefile
+++ b/admin/syslog-ng/Makefile
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=syslog-ng
PKG_VERSION:=3.21.1
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
PKG_LICENSE:=LGPL-2.1+
@@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/nls.mk
define Package/syslog-ng
SECTION:=admin
CATEGORY:=Administration
- DEPENDS:=+libpcre +glib2 +libopenssl +libpthread +librt +zlib +libdbi +libjson-c +libcurl +libuuid
+ DEPENDS:=+libpcre +glib2 +libopenssl +libpthread +librt +zlib +libdbi +libjson-c +libcurl +libuuid +logrotate
TITLE:=A powerful syslog daemon
URL:=https://www.syslog-ng.com/products/open-source-log-management/
endef
@@ -84,6 +84,8 @@ define Package/syslog-ng/install
touch $(1)/etc/syslog-ng.d/.keep
$(INSTALL_BIN) ./files/logread $(1)/usr/sbin
+ $(INSTALL_DIR) $(1)/etc/logrotate.d
+ $(INSTALL_DATA) ./files/logrotate.conf $(1)/etc/logrotate.d/syslog-ng.conf
endef
define Package/syslog-ng/postinst
diff --git a/admin/syslog-ng/files/logrotate.conf b/admin/syslog-ng/files/logrotate.conf
new file mode 100644
index 0000000..ce1e087
--- /dev/null
+++ b/admin/syslog-ng/files/logrotate.conf
@@ -0,0 +1,8 @@
+/var/log/messages {
+ maxsize 1M
+ compress
+ delaycompress
+ postrotate
+ /etc/init.d/syslog-ng restart
+ endscript
+}
--
2.21.0