set logrotate
This commit is contained in:
parent
5fe7785039
commit
e4e8c5de6a
53
set-logrotate.patch
Normal file
53
set-logrotate.patch
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
From b0bec0a4afd8bd38c4944f8d1dfdefcee151b624 Mon Sep 17 00:00:00 2001
|
||||||
|
From: shixuantong <shixuantong1@huawei.com>
|
||||||
|
Date: Thu, 12 Dec 2024 11:47:22 +0800
|
||||||
|
Subject: [PATCH] set logrotate
|
||||||
|
|
||||||
|
---
|
||||||
|
config/{logrotate => logrotate-sysSentry.conf} | 4 ++--
|
||||||
|
src/sh/logrotate-sysSentry.cron | 13 +++++++++++++
|
||||||
|
2 files changed, 15 insertions(+), 2 deletions(-)
|
||||||
|
rename config/{logrotate => logrotate-sysSentry.conf} (83%)
|
||||||
|
create mode 100644 src/sh/logrotate-sysSentry.cron
|
||||||
|
|
||||||
|
diff --git a/config/logrotate b/config/logrotate-sysSentry.conf
|
||||||
|
similarity index 83%
|
||||||
|
rename from config/logrotate
|
||||||
|
rename to config/logrotate-sysSentry.conf
|
||||||
|
index 3dc77f5..32f063f 100644
|
||||||
|
--- a/config/logrotate
|
||||||
|
+++ b/config/logrotate-sysSentry.conf
|
||||||
|
@@ -1,9 +1,9 @@
|
||||||
|
/var/log/sysSentry/*.log {
|
||||||
|
+ create
|
||||||
|
compress
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
copytruncate
|
||||||
|
- rotate 2
|
||||||
|
+ rotate 4
|
||||||
|
size +4096k
|
||||||
|
- hourly
|
||||||
|
}
|
||||||
|
diff --git a/src/sh/logrotate-sysSentry.cron b/src/sh/logrotate-sysSentry.cron
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..64d02f9
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/sh/logrotate-sysSentry.cron
|
||||||
|
@@ -0,0 +1,13 @@
|
||||||
|
+#!/bin/sh
|
||||||
|
+
|
||||||
|
+TMPF=`mktemp /tmp/logrotate-sysSentry.XXXXXXXXX`
|
||||||
|
+
|
||||||
|
+/usr/sbin/logrotate /etc/logrotate-sysSentry.conf -v --log=$TMPF -s /var/lib/logrotate-syssentry/logrotate.status
|
||||||
|
+EXITVALUE=$?
|
||||||
|
+if [ $EXITVALUE != 0 ]; then
|
||||||
|
+ /bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE], for details, see /var/log/sysSentry/logrotate.log"
|
||||||
|
+ /bin/logger -t logrotate -f $TMPF
|
||||||
|
+fi
|
||||||
|
+rm -rf $TMPF
|
||||||
|
+rm -rf /var/lib/logrotate-syssentry/logrotate.status
|
||||||
|
+exit $EXITVALUE
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -4,7 +4,7 @@
|
|||||||
Summary: System Inspection Framework
|
Summary: System Inspection Framework
|
||||||
Name: sysSentry
|
Name: sysSentry
|
||||||
Version: 1.0.2
|
Version: 1.0.2
|
||||||
Release: 70
|
Release: 71
|
||||||
License: Mulan PSL v2
|
License: Mulan PSL v2
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||||
@ -86,6 +86,7 @@ Patch73: fix-absolute-threshold-not-be-used.patch
|
|||||||
Patch74: add-debug-log-and-modify-disk-type-for-ebpf.patch
|
Patch74: add-debug-log-and-modify-disk-type-for-ebpf.patch
|
||||||
Patch75: remove-cpu_sentry.patch
|
Patch75: remove-cpu_sentry.patch
|
||||||
Patch76: uniform-avg_block_io-log-and-ai_block_io-log.patch
|
Patch76: uniform-avg_block_io-log-and-ai_block_io-log.patch
|
||||||
|
Patch77: set-logrotate.patch
|
||||||
|
|
||||||
BuildRequires: cmake gcc-c++
|
BuildRequires: cmake gcc-c++
|
||||||
BuildRequires: python3 python3-setuptools
|
BuildRequires: python3 python3-setuptools
|
||||||
@ -194,12 +195,10 @@ install -m 700 src/c/ebpf_collector/output/ebpf_collector.bpf.o %{buildroot}/usr
|
|||||||
|
|
||||||
# xalarm
|
# xalarm
|
||||||
sh build/build.sh -i %{buildroot}%{_libdir}
|
sh build/build.sh -i %{buildroot}%{_libdir}
|
||||||
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
|
|
||||||
install -m 600 config/xalarm.conf %{buildroot}%{_sysconfdir}/sysSentry
|
install -m 600 config/xalarm.conf %{buildroot}%{_sysconfdir}/sysSentry
|
||||||
install -d %{buildroot}%{_libdir}
|
install -d %{buildroot}%{_libdir}
|
||||||
install -d %{buildroot}%{_includedir}/xalarm
|
install -d %{buildroot}%{_includedir}/xalarm
|
||||||
install -m 600 service/xalarmd.service %{buildroot}%{_unitdir}
|
install -m 600 service/xalarmd.service %{buildroot}%{_unitdir}
|
||||||
install -m 600 config/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/sysSentry
|
|
||||||
install -m 644 src/libso/xalarm/register_xalarm.h %{buildroot}%{_includedir}/xalarm/register_xalarm.h
|
install -m 644 src/libso/xalarm/register_xalarm.h %{buildroot}%{_includedir}/xalarm/register_xalarm.h
|
||||||
|
|
||||||
# sentryCollector
|
# sentryCollector
|
||||||
@ -214,6 +213,12 @@ install config/plugins/avg_block_io.ini %{buildroot}/etc/sysSentry/plugins/avg_b
|
|||||||
install config/tasks/ai_block_io.mod %{buildroot}/etc/sysSentry/tasks/
|
install config/tasks/ai_block_io.mod %{buildroot}/etc/sysSentry/tasks/
|
||||||
install config/plugins/ai_block_io.ini %{buildroot}/etc/sysSentry/plugins/ai_block_io.ini
|
install config/plugins/ai_block_io.ini %{buildroot}/etc/sysSentry/plugins/ai_block_io.ini
|
||||||
|
|
||||||
|
# logrotate
|
||||||
|
mkdir -p %{buildroot}%{_localstatedir}/lib/logrotate-syssentry
|
||||||
|
mkdir -p %{buildroot}%{_sysconfdir}/cron.hourly
|
||||||
|
install -m 0600 config/logrotate-sysSentry.conf %{buildroot}%{_sysconfdir}/logrotate-sysSentry.conf
|
||||||
|
install -m 0500 src/sh/logrotate-sysSentry.cron %{buildroot}%{_sysconfdir}/cron.hourly/logrotate-sysSentry
|
||||||
|
|
||||||
pushd src/python
|
pushd src/python
|
||||||
python3 setup.py install -O1 --root=$RPM_BUILD_ROOT --record=SENTRY_FILES
|
python3 setup.py install -O1 --root=$RPM_BUILD_ROOT --record=SENTRY_FILES
|
||||||
cat SENTRY_FILES | grep -v register_xalarm.* | grep -v sentry_notify.* > SENTRY_FILES.tmp
|
cat SENTRY_FILES | grep -v register_xalarm.* | grep -v sentry_notify.* > SENTRY_FILES.tmp
|
||||||
@ -265,10 +270,14 @@ rm -rf %{buildroot}
|
|||||||
|
|
||||||
# xalarm
|
# xalarm
|
||||||
%attr(0550,root,root) %{_bindir}/xalarmd
|
%attr(0550,root,root) %{_bindir}/xalarmd
|
||||||
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/sysSentry
|
|
||||||
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/xalarm.conf
|
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/xalarm.conf
|
||||||
%attr(0600,root,root) %{_unitdir}/xalarmd.service
|
%attr(0600,root,root) %{_unitdir}/xalarmd.service
|
||||||
|
|
||||||
|
# logrotate
|
||||||
|
%dir %{_localstatedir}/lib/logrotate-syssentry
|
||||||
|
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/logrotate-sysSentry.conf
|
||||||
|
%attr(0500,root,root) %{_sysconfdir}/cron.hourly/logrotate-sysSentry
|
||||||
|
|
||||||
# cpu inspection module
|
# cpu inspection module
|
||||||
%exclude %{python3_sitelib}/syssentry/cpu_*
|
%exclude %{python3_sitelib}/syssentry/cpu_*
|
||||||
%exclude %{python3_sitelib}/syssentry/*/cpu_*
|
%exclude %{python3_sitelib}/syssentry/*/cpu_*
|
||||||
@ -327,6 +336,12 @@ rm -rf %{buildroot}
|
|||||||
%attr(0550,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin*
|
%attr(0550,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Dec 18 2024 shixuantong <shixuantong@huawei.com> - 1.0.2-71
|
||||||
|
- Type:enhancement
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:set logrotate
|
||||||
|
|
||||||
* Wed Dec 18 2024 jinsaihang <jinsaihang@h-partners.com> - 1.0.2-70
|
* Wed Dec 18 2024 jinsaihang <jinsaihang@h-partners.com> - 1.0.2-70
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user