Put all logrotate config to a file per offering (#23)
Not having one logrotate file produced an error during rpmlint. It makes sense to have one logrotate file after Memgraph is installed because it's easier to manage config files. There are two logrotate files in the codebase, one for Community and one for Enterprise edition. Having rotate files per offering also makes sense because offerings are affected less often compared to the features. It's easier to maintain.
This commit is contained in:
parent
e525818355
commit
291158160d
@ -41,6 +41,7 @@ if (MG_ENTERPRISE)
|
||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/enterprise/conffiles;"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/enterprise/copyright;"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/preinst;"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/prerm;"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/postrm;"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/postinst;")
|
||||
@ -48,6 +49,7 @@ else()
|
||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/community/conffiles;"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/community/copyright;"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/preinst;"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/prerm;"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/postrm;"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debian/postinst;")
|
||||
|
@ -16,7 +16,7 @@ optdepends=()
|
||||
provides=()
|
||||
conflicts=()
|
||||
replaces=()
|
||||
backup=("etc/memgraph/memgraph.conf" "etc/logrotate.d/memgraph" "etc/logrotate.d/memgraph_audit")
|
||||
backup=("etc/memgraph/memgraph.conf" "etc/logrotate.d/memgraph")
|
||||
options=()
|
||||
install=memgraph.install
|
||||
changelog=
|
||||
|
@ -1,4 +1,3 @@
|
||||
/etc/memgraph/memgraph.conf
|
||||
/etc/memgraph/auth_module/ldap.example.yaml
|
||||
/etc/logrotate.d/memgraph
|
||||
/etc/logrotate.d/memgraph_audit
|
||||
|
@ -86,4 +86,9 @@ if [ -d /run/systemd/system ]; then
|
||||
deb-systemd-invoke start memgraph.service >/dev/null || true
|
||||
fi
|
||||
|
||||
# Take a look at the preinst script for the detailed explanation.
|
||||
if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
|
||||
dpkg-maintscript-helper rm_conffile /etc/logrotate.d/memgraph_audit 1.1.999 -- "$@"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@ -71,4 +71,9 @@ if [ "$1" = "purge" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Take a look at the preinst script for the detailed explanation.
|
||||
if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
|
||||
dpkg-maintscript-helper rm_conffile /etc/logrotate.d/memgraph_audit 1.1.999 -- "$@"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
19
release/debian/preinst
Normal file
19
release/debian/preinst
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# preinst script for memgraph
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# Manage (remove) /etc/logrotate.d/memgraph_audit file because the whole
|
||||
# logrotate config is moved to /etc/logrotate.d/memgraph since v1.2.0.
|
||||
# Note: Only used to manage Memgraph Enterprise config but packaged into the
|
||||
# Memgraph Community as well.
|
||||
if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
|
||||
# 1.1.999 is chosen because it's high enough version number. It's highly
|
||||
# unlikely (impossible) that the patch number in v1.1 reaches 999
|
||||
# (it's 0 on 2020-10-17).
|
||||
# Tested with: `dpkg --compare-versions -- "1.2" le-nl "1.1.999"`
|
||||
# (used inside dpkg-maintscript-helper script).
|
||||
dpkg-maintscript-helper rm_conffile /etc/logrotate.d/memgraph_audit 1.1.999 -- "$@"
|
||||
fi
|
@ -1,4 +1,4 @@
|
||||
# logrotate configuration for Memgraph logs
|
||||
# logrotate configuration for Memgraph Community
|
||||
# see "man logrotate" for details
|
||||
|
||||
/var/log/memgraph/memgraph.log {
|
@ -1,6 +1,17 @@
|
||||
# logrotate configuration for Memgraph Audit logs
|
||||
# logrotate configuration for Memgraph Enterprise
|
||||
# see "man logrotate" for details
|
||||
|
||||
/var/log/memgraph/memgraph.log {
|
||||
# rotate log files weekly
|
||||
weekly
|
||||
# keep 5 weeks worth of backlog
|
||||
rotate 5
|
||||
# send SIGUSR1 to notify memgraph to recreate logfile
|
||||
postrotate
|
||||
/usr/bin/killall -s SIGUSR1 memgraph
|
||||
endscript
|
||||
}
|
||||
|
||||
/var/lib/memgraph/durability/audit/audit.log {
|
||||
# rotate log files daily
|
||||
daily
|
@ -139,7 +139,6 @@ chattr -i -R /usr/share/memgraph/examples || true
|
||||
%config(noreplace) "/etc/memgraph/memgraph.conf"
|
||||
%config(noreplace) "/etc/memgraph/auth_module/ldap.example.yaml"
|
||||
%config(noreplace) "/etc/logrotate.d/memgraph"
|
||||
%config(noreplace) "/etc/logrotate.d/memgraph_audit"
|
||||
|
||||
@CPACK_RPM_USER_INSTALL_FILES@
|
||||
|
||||
|
@ -107,11 +107,12 @@ install(FILES ${CMAKE_SOURCE_DIR}/include/mg_procedure.h
|
||||
install(FILES ${CMAKE_BINARY_DIR}/config/memgraph.conf
|
||||
DESTINATION /etc/memgraph RENAME memgraph.conf)
|
||||
# Install logrotate configuration (must use absolute path).
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/release/logrotate.conf
|
||||
DESTINATION /etc/logrotate.d RENAME memgraph)
|
||||
if (MG_ENTERPRISE)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/release/logrotate_audit.conf
|
||||
DESTINATION /etc/logrotate.d RENAME memgraph_audit)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/release/logrotate_enterprise.conf
|
||||
DESTINATION /etc/logrotate.d RENAME memgraph)
|
||||
else()
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/release/logrotate_community.conf
|
||||
DESTINATION /etc/logrotate.d RENAME memgraph)
|
||||
endif()
|
||||
# Create empty directories for default location of lib and log.
|
||||
install(CODE "file(MAKE_DIRECTORY \$ENV{DESTDIR}/var/log/memgraph
|
||||
|
Loading…
Reference in New Issue
Block a user