summaryrefslogtreecommitdiffstats
path: root/logd
diff options
context:
space:
mode:
authorArne Juul <arnej@yahoo-inc.com>2018-09-10 09:42:07 +0000
committerArne Juul <arnej@yahoo-inc.com>2018-09-10 09:42:12 +0000
commit0405996db1837eaa6d31207ea2b9838ead164f7e (patch)
tree402c7a3598c1148c52cdb7ee3b11b1526cb899ee /logd
parentfbda56634afbd99498279f0ba342a7a5e815ea0f (diff)
add some comments, adjust timestamp extension
Diffstat (limited to 'logd')
-rwxr-xr-xlogd/src/apps/retention/retention-enforcer.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/logd/src/apps/retention/retention-enforcer.sh b/logd/src/apps/retention/retention-enforcer.sh
index ff743834b28..7ab1b27d71a 100755
--- a/logd/src/apps/retention/retention-enforcer.sh
+++ b/logd/src/apps/retention/retention-enforcer.sh
@@ -1,10 +1,19 @@
#!/bin/sh
+# daemon that collects old log files.
+# global settings:
+
DBGF=logs/vespa/debug.retention-enforcer
DBDIR=var/db/vespa/logfiledb
PIDF=$DBDIR/retention-enforcer.pid
RETAIN_DAYS=31
+# this depends on components adding their log files
+# to a "database" in DBDIR named "logfiles.TTTTT" where
+# TTTTT is a timestamp in format (seconds/100000).
+# The "database" holds lines with format "timestamp /path/to/logfile"
+# where "timestamp" is just seconds since epoch.
+
prereq_dir() {
if [ -d $1 ] && [ -w $1 ]; then
:
@@ -100,7 +109,7 @@ process_file() {
done
done < $dbfile
if [ $found = 0 ]; then
- ts=${dbfile##*.}00000
+ ts=${dbfile##*.}99999
maybe_collect "$ts" "$dbfile"
fi
}
@@ -121,6 +130,8 @@ mainloop() {
done
}
+# MAIN:
+
prepare_stuff
mainloop
exit 0