This repository contains the code for ohpc-log-analyzer. This is a tool,
written in Rust, which is specifically written to analyze the Apache HTTP
Server log files generated on OpenHPC's
repository server.
The output which is generated by ohpc-log-analyzer can be seen at
https://repos.openhpc.community/stats/.
Reading every log again on each run is the bulk of the runtime. With
--cache-directory DIR the counters derived from each input file are stored
in DIR and reused for as long as that file is unchanged, so a log that has
been rotated is parsed once and only read back as counters afterwards:
$ ohpc-log-analyzer --cache-directory /var/cache/ohpc-log-analyzer \
/var/log/httpd/old/access_log /var/log/httpd/access_log_2026-10 \
/var/log/httpd/access_logAn entry is used only when the path, size, modification time and inode of the input all still match, so a log that was appended to, rotated or replaced is parsed again. An entry that cannot be decoded is ignored rather than trusted, so a truncated or corrupt cache costs a reparse but never changes the results.
The cache holds the per-address sets that the unique visitor counts are
derived from, which makes it sizeable: around 50 MB for the full OpenHPC log
set. Those sets are the raw client addresses, so the cache directory must
never be inside a directory a web server publishes. Entries are written with
mode 0600, but that only protects them while the analyzer and the web
server run as different users: keeping the directory out of the document
root is what actually makes it safe.
Entries are removed again once they are of no further use: when the log file
an entry was written for no longer exists, which is what a rotated daily log
leaves behind, and when the entry was written by a different CACHE_VERSION.
An input left out of a single run keeps its entry, so a run over a subset of
the logs does not discard the rest of the cache.
CACHE_VERSION in src/main.rs has to be increased whenever a change to the
parsing alters the counts a given log file produces. Entries written by a
different version are ignored, so raising it is what stops a parsing fix from
being masked by numbers cached before it.