1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-29 18:50:08 +03:00

B #6034 Fix log rotation (#2415) (#2816)

* Revert "F #5328: Update logrotate behavior to avoid long restarts (#2275)". This reverts commit 6b1127f180bcc4416bec3b7226629b392dd18737.

* B #5328: Don't wait for log compressing
* B #6034: Don't overwrite logs

While having already `copytruncate` in logroate we don't need to implement signaling and re-openning files.

* L #-: Linting
This commit is contained in:
Jan Orel 2023-11-15 13:18:09 +01:00 committed by GitHub
parent c65622f603
commit 7e1f78ace9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 30 additions and 31 deletions

View File

@ -1,9 +1,6 @@
/var/log/one/one_xmlrpc.log /var/log/one/oned.log /var/log/one/monitor.log /var/log/one/vcenter_monitor.log {
delaycompress
dateext
dateformat -%Y%m%d-%s
compress
maxsize 100M
weekly
rotate 52
missingok

View File

@ -1,9 +1,6 @@
/var/log/one/fireedge.log {
delaycompress
dateext
dateformat -%Y%m%d-%s
compress
maxsize 100M
weekly
rotate 52
missingok

View File

@ -1,9 +1,6 @@
/var/log/one/oneflow.log {
delaycompress
dateext
dateformat -%Y%m%d-%s
compress
maxsize 100M
weekly
rotate 52
missingok

View File

@ -1,9 +1,6 @@
/var/log/one/onegate.log {
delaycompress
dateext
dateformat -%Y%m%d-%s
compress
maxsize 100M
weekly
rotate 52
missingok

View File

@ -1,9 +1,6 @@
/var/log/one/onehem.log {
delaycompress
dateext
dateformat -%Y%m%d-%s
compress
maxsize 100M
weekly
rotate 52
missingok

View File

@ -1,9 +1,6 @@
/var/log/one/novnc.log {
delaycompress
dateext
dateformat -%Y%m%d-%s
compress
maxsize 100M
weekly
rotate 52
missingok

View File

@ -1,9 +1,6 @@
/var/log/one/sched.log {
delaycompress
dateext
dateformat -%Y%m%d-%s
compress
maxsize 100M
weekly
rotate 52
missingok

View File

@ -1,9 +1,6 @@
/var/log/one/sunstone.log {
delaycompress
dateext
dateformat -%Y%m%d-%s
compress
maxsize 100M
weekly
rotate 52
missingok

View File

@ -38,6 +38,7 @@ do_start()
{
mkdir -p /var/run/one /var/lock/one
chown oneadmin /var/run/one /var/lock/one
logrotate -f /etc/logrotate.d/opennebula /etc/logrotate.d/opennebula-scheduler
su oneadmin -s /bin/sh -c 'one start'
ONE_START=$?
@ -65,6 +66,7 @@ do_stop()
do_start_sched()
{
logrotate -f /etc/logrotate.d/opennebula-scheduler
su oneadmin -s /bin/sh -c 'one start-sched'
}

View File

@ -36,6 +36,7 @@ do_start()
{
mkdir -p /var/run/one /var/lock/one /var/log/one
chown oneadmin /var/run/one /var/lock/one /var/log/one
logrotate -f /etc/logrotate.d/opennebula-flow
su oneadmin -s /bin/sh -c "$DAEMON start"
}

View File

@ -36,6 +36,7 @@ do_start()
{
mkdir -p /var/run/one /var/lock/one /var/log/one
chown oneadmin /var/run/one /var/lock/one /var/log/one
logrotate -f /etc/logrotate.d/opennebula-gate
su oneadmin -s /bin/sh -c "$DAEMON start"
}

View File

@ -35,6 +35,7 @@ do_start()
{
mkdir -p /var/lock/one /var/log/one
chown oneadmin /var/lock/one /var/log/one
logrotate -f /etc/logrotate.d/opennebula-novnc
su oneadmin -s /bin/sh -c "$DAEMON start"
}

View File

@ -37,6 +37,7 @@ do_start()
service opennebula-novnc start
mkdir -p /var/run/one /var/lock/one /var/log/one
chown oneadmin /var/run/one /var/lock/one /var/log/one
logrotate -f /etc/logrotate.d/opennebula-sunstone
su oneadmin -s /bin/sh -c "$DAEMON start-sunstone"
}

View File

@ -10,6 +10,8 @@ AssertFileNotEmpty=/var/lib/one/.one/sunstone_auth
Type=simple
Group=oneadmin
User=oneadmin
ExecStartPre=-/usr/sbin/logrotate -f /etc/logrotate.d/opennebula-fireedge -s /var/lib/one/.logrotate.status
ExecStartPre=-sh 'gzip -9 /var/log/one/fireedge.log-* &'
ExecStart=/bin/sh -c 'exec node /usr/lib/one/fireedge/dist/index.js >>/var/log/one/fireedge.log 2>>/var/log/one/fireedge.error'
StartLimitInterval=60
StartLimitBurst=3

View File

@ -8,6 +8,8 @@ AssertFileNotEmpty=/var/lib/one/.one/oneflow_auth
Type=simple
Group=oneadmin
User=oneadmin
ExecStartPre=-/usr/sbin/logrotate -f /etc/logrotate.d/opennebula-flow -s /var/lib/one/.logrotate.status
ExecStartPre=-sh 'gzip -9 /var/log/one/oneflow.log-* &'
ExecStart=/usr/bin/ruby /usr/lib/one/oneflow/oneflow-server.rb
StartLimitInterval=60
StartLimitBurst=3

View File

@ -8,6 +8,8 @@ AssertFileNotEmpty=/var/lib/one/.one/onegate_auth
Type=simple
Group=oneadmin
User=oneadmin
ExecStartPre=-/usr/sbin/logrotate -f /etc/logrotate.d/opennebula-gate -s /var/lib/one/.logrotate.status
ExecStartPre=-sh 'gzip -9 /var/log/one/onegate.log-* &'
ExecStart=/usr/bin/ruby /usr/lib/one/onegate/onegate-server.rb
StartLimitInterval=60
StartLimitBurst=3

View File

@ -8,6 +8,8 @@ Type=simple
Group=oneadmin
User=oneadmin
EnvironmentFile=-/var/run/one/ssh-agent.env
ExecStartPre=-/usr/sbin/logrotate -f /etc/logrotate.d/opennebula-hem -s /var/lib/one/.logrotate.status
ExecStartPre=-sh 'gzip -9 /var/log/one/onehem.log-* &'
ExecStart=/usr/bin/ruby /usr/lib/one/onehem/onehem-server.rb
StartLimitInterval=60
StartLimitBurst=3

View File

@ -6,6 +6,8 @@ After=syslog.target network.target
Type=forking
Group=oneadmin
User=oneadmin
ExecStartPre=-/usr/sbin/logrotate -f /etc/logrotate.d/opennebula-novnc -s /var/lib/one/.logrotate.status
ExecStartPre=-sh 'gzip -9 /var/log/one/novnc.log-* &'
ExecStart=/usr/bin/novnc-server start
PIDFile=/var/lock/one/.novnc.lock
StartLimitInterval=60

View File

@ -8,6 +8,8 @@ AssertFileNotEmpty=/var/lib/one/.one/one_auth
Type=simple
Group=oneadmin
User=oneadmin
ExecStartPre=-/usr/sbin/logrotate -f /etc/logrotate.d/opennebula-scheduler -s /var/lib/one/.logrotate.status
ExecStartPre=-sh 'gzip -9 /var/log/one/sched.log-* &'
ExecStart=/usr/bin/mm_sched
StartLimitInterval=60
StartLimitBurst=3

View File

@ -10,6 +10,8 @@ Type=simple
Group=oneadmin
User=oneadmin
AmbientCapabilities=CAP_NET_BIND_SERVICE
ExecStartPre=-/usr/sbin/logrotate -f /etc/logrotate.d/opennebula-sunstone -s /var/lib/one/.logrotate.status
ExecStartPre=-sh 'gzip -9 /var/log/one/sunstone.log-* &'
ExecStart=/usr/bin/ruby /usr/lib/one/sunstone/sunstone-server.rb
ReadWriteDirectories=/var/lib/one /var/log/one/
ReadOnlyDirectories=-/var/lib/one/remotes

View File

@ -14,6 +14,9 @@ Group=oneadmin
User=oneadmin
Environment="PATH=/usr/lib/one/sh/override:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
EnvironmentFile=-/var/run/one/ssh-agent.env
ExecStartPre=-/usr/sbin/logrotate -f /etc/logrotate.d/opennebula -s /var/lib/one/.logrotate.status
ExecStartPre=-sh 'gzip -9 /var/log/one/oned.log-* /var/log/one/monitor.log-* /var/log/one/vcenter_monitor.log-* &'
ExecStartPre=/usr/share/one/pre_cleanup
ExecStart=/usr/bin/oned -f
ExecStopPost=/usr/share/one/follower_cleanup
PIDFile=/var/lock/one/one

View File

@ -76,7 +76,7 @@ start()
touch $FIREEDGE_LOCK_FILE
# Start the fireedge-server daemon
node $FIREEDGE_SERVER >$FIREEDGE_LOG &
node $FIREEDGE_SERVER >>$FIREEDGE_LOG &
LASTRC=$?
LASTPID=$!

View File

@ -59,7 +59,7 @@ start()
touch $FLOW_LOCK_FILE
# Start the oneflow-server daemon
ruby $FLOW_SERVER >$FLOW_LOG 2>$FLOW_LOG_ERROR &
ruby $FLOW_SERVER >>$FLOW_LOG 2>>$FLOW_LOG_ERROR &
LASTRC=$?
LASTPID=$!

View File

@ -69,7 +69,7 @@ void Monitor::start()
NebulaLog::init_log_system(log_system,
clevel,
log_file.c_str(),
ios_base::trunc,
ios_base::ate,
"one_monitor");
}
else

View File

@ -223,7 +223,7 @@ void Nebula::start(bool bootstrap_only)
NebulaLog::init_log_system(log_system,
clevel,
log_fname.c_str(),
ios_base::trunc,
ios_base::ate,
"oned");
}
else

View File

@ -59,7 +59,7 @@ start()
# Start the onegate daemon
touch $ONEGATE_LOCK_FILE
ruby $ONEGATE_SERVER > $ONEGATE_LOG 2>$ONEGATE_LOG_ERROR &
ruby $ONEGATE_SERVER >> $ONEGATE_LOG 2>>$ONEGATE_LOG_ERROR &
LASTPID=$!
if [ $? -ne 0 ]; then

View File

@ -169,7 +169,7 @@ void Scheduler::start()
NebulaLog::init_log_system(log_system,
clevel,
log_file.c_str(),
ios_base::trunc,
ios_base::ate,
"mm_sched");
}
else

View File

@ -92,7 +92,7 @@ start()
exit 1
fi
ruby $SUNSTONE_SERVER > $SUNSTONE_LOG 2>$SUNSTONE_LOG_ERROR &
ruby $SUNSTONE_SERVER >> $SUNSTONE_LOG 2>>$SUNSTONE_LOG_ERROR &
LASTPID=$!
if [ $? -ne 0 ]; then