web-logs/Makefile: Use only the previous day's logs to avoid overlap.
authorMatt McCutchen <matt@mattmccutchen.net>
Fri, 18 Sep 2020 14:38:46 +0000 (10:38 -0400)
committerMatt McCutchen <matt@mattmccutchen.net>
Fri, 18 Sep 2020 14:38:46 +0000 (10:38 -0400)
web-logs/Makefile

index c338031..9db4475 100644 (file)
@@ -43,12 +43,14 @@ log_line_regex := ^([^ ]+)( [^"]*)"(([^"\\]|\\.)*)" ([0-9]+) ([^"]*)"(([^"\\]|\\
 # \7: referrer (ditto \3)
 # \9: user agent (ditto \3)
 
 # \7: referrer (ditto \3)
 # \9: user agent (ditto \3)
 
-# Take the current and previous day's logs.  If I look once a day (DreamHost time),
-# this should catch everything with some overlap.  TODO: Avoid the overlap?
-# Requires sth more sophisticated to track what I've already seen.
+# Take the previous day's logs.  If I look once a day (DreamHost time), this
+# should catch everything with no overlap.  I previously included the current
+# day's logs, but I now think the difficulty of maintaining an accurate sense of
+# usage in the presence of overlap is a greater evil than up to a day of extra
+# latency.  I might find a better solution in the future.
 #
 # Filename pattern for recent-logs is locked down in pull-logs, so we shouldn't have shell injection here.
 #
 # Filename pattern for recent-logs is locked down in pull-logs, so we shouldn't have shell injection here.
-recent_logs := $(shell ls -t recent-logs/access.log* | head -n 2 | tac)
+recent_logs := $(shell ls -t recent-logs/access.log* | head -n 2 | tail -n 1 | tac)
 
 $G/logs: $(recent_logs)
        cat $^ >$@
 
 $G/logs: $(recent_logs)
        cat $^ >$@