Skip to content

Commit

Permalink
Merge pull request #560 from krakendio/syslog
Browse files Browse the repository at this point in the history
Add rsyslog and logrotate
  • Loading branch information
taik0 authored Sep 20, 2022
2 parents 4c33cbf + 84ccbc0 commit 06afa0a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ FPM_OPTS=-s dir -v $(VERSION) -n $(PKGNAME) \

DEB_OPTS= -t deb --deb-user $(USER) \
--depends ca-certificates \
--depends rsyslog \
--depends logrotate \
--before-remove builder/scripts/prerm.deb \
--after-remove builder/scripts/postrm.deb \
--before-install builder/scripts/preinst.deb

RPM_OPTS =--rpm-user $(USER) \
--depends rsyslog \
--depends logrotate \
--before-install builder/scripts/preinst.rpm \
--before-remove builder/scripts/prerm.rpm \
--after-remove builder/scripts/postrm.rpm
Expand Down Expand Up @@ -107,6 +111,14 @@ builder/skel/%/usr/lib/systemd/system/krakend.service: builder/files/krakend.ser
mkdir -p "$(dir $@)"
cp builder/files/krakend.service "$@"

builder/skel/%/etc/rsyslog.d/krakend.conf: builder/files/krakend.conf-rsyslog
mkdir -p "$(dir $@)"
cp builder/files/krakend.conf-rsyslog "$@"

builder/skel/%/etc/logrotate.d/krakend: builder/files/krakend-logrotate
mkdir -p "$(dir $@)"
cp builder/files/krakend-logrotate "$@"

.PHONE: tgz
tgz: builder/skel/tgz/usr/bin/krakend
tgz: builder/skel/tgz/etc/krakend/krakend.json
Expand All @@ -116,6 +128,8 @@ tgz: builder/skel/tgz/etc/init.d/krakend
.PHONY: deb
deb: builder/skel/deb/usr/bin/krakend
deb: builder/skel/deb/etc/krakend/krakend.json
deb: builder/skel/deb/etc/rsyslog.d/krakend.conf
deb: builder/skel/deb/etc/logrotate.d/krakend
docker run --rm -it -v "${PWD}:${DOCKER_WDIR}" -w ${DOCKER_WDIR} ${DOCKER_FPM}:deb -t deb ${DEB_OPTS} \
--iteration ${RELEASE} \
--deb-systemd builder/files/krakend.service \
Expand All @@ -126,6 +140,8 @@ deb: builder/skel/deb/etc/krakend/krakend.json
rpm: builder/skel/rpm/usr/lib/systemd/system/krakend.service
rpm: builder/skel/rpm/usr/bin/krakend
rpm: builder/skel/rpm/etc/krakend/krakend.json
rpm: builder/skel/rpm/etc/rsyslog.d/krakend.conf
rpm: builder/skel/rpm/etc/logrotate.d/krakend
docker run --rm -it -v "${PWD}:${DOCKER_WDIR}" -w ${DOCKER_WDIR} ${DOCKER_FPM}:rpm -t rpm ${RPM_OPTS} \
--iteration ${RELEASE} \
-C builder/skel/rpm \
Expand Down
11 changes: 11 additions & 0 deletions builder/files/krakend-logrotate
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/var/log/krakend.log
{
rotate 7
daily
missingok
delaycompress
compress
postrotate
/usr/lib/rsyslog/rsyslog-rotate
endscript
}
1 change: 1 addition & 0 deletions builder/files/krakend.conf-rsyslog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local3.* -/var/log/krakend.log

0 comments on commit 06afa0a

Please sign in to comment.