mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-10 12:22:10 +03:00
contrib/eddn-logs-archive: Produce report on rotated logfile
This commit is contained in:
parent
cc5ae32227
commit
40a1d11e76
@ -87,7 +87,8 @@ do
|
|||||||
log " Archiving ${service}.log ..."
|
log " Archiving ${service}.log ..."
|
||||||
# We have no means to tell the service to close and re-open output, it's
|
# We have no means to tell the service to close and re-open output, it's
|
||||||
# to stdout/err anyway. So we copy it.
|
# to stdout/err anyway. So we copy it.
|
||||||
COMPRESSED_NAME="${service}.log.$(date --iso-8601=seconds)"
|
TIMESTAMP="$(date --iso-8601=seconds)"
|
||||||
|
COMPRESSED_NAME="${service}.log.${TIMESTAMP}"
|
||||||
cp ${service}.log "${COMPRESSED_NAME}"
|
cp ${service}.log "${COMPRESSED_NAME}"
|
||||||
if [ $? -ne 0 ];
|
if [ $? -ne 0 ];
|
||||||
then
|
then
|
||||||
@ -97,6 +98,11 @@ do
|
|||||||
fi
|
fi
|
||||||
# Truncate the live file.
|
# Truncate the live file.
|
||||||
:> ${service}.log
|
:> ${service}.log
|
||||||
|
|
||||||
|
# Produce a report on the just-rotated log
|
||||||
|
${HOME}/.local/bin/eddn-report-log-errors "${COMPRESSED_NAME}" > \
|
||||||
|
"${HOME}/reports/eddn-errors/by-log-rotation/eddn-errors-${TIMESTMAP}.txt"
|
||||||
|
|
||||||
# Now compress the newly archived log
|
# Now compress the newly archived log
|
||||||
gzip -9v "${COMPRESSED_NAME}"
|
gzip -9v "${COMPRESSED_NAME}"
|
||||||
log " DONE"
|
log " DONE"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user