You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Address review of the check_logfile bookmark option
Four things the review of #1406 turned up, all in the new bookmark path.
An explicitly empty value (`bookmark=`) silently disabled bookmarking
even though the documentation says an empty value means `auto`. The REST
API renders a valueless parameter as a bare token so it never hit this,
but the client-query path passes `k=v` through verbatim and a check
written that way quietly went back to reporting the whole file on every
run. The option now uses a notifier instead of binding a variable, which
is what tells "given without a value" apart from "not given at all", and
maps the empty value to `auto`.
Positions moved as each file was read, so a check which failed on a
later file - a second `file=` which cannot be opened - returned an error
having already consumed the lines of the files before it, and nothing
ever reported them. Positions are now collected and applied only once
every file has been read.
Nothing bounded the stored state. A bookmark name comes from the caller
and an automatic one changes with the filter, so a host which generates
names grew nsclient.db without end. Positions are now held in a bounded
LRU map (1000 file/bookmark pairs); a position which ages out is dropped
from the live set and blanked in the store on the next shutdown, and its
file is simply read in full the next time that name appears. The
automatic name also carries a hash of the filter, warning and critical
expressions rather than the expressions themselves, so a filter of
arbitrary length and content no longer ends up in the persisted key.
Finally the documentation now covers what a bookmark costs: a line is
consumed when the check runs rather than when its result is submitted,
positions are saved on a clean shutdown so a crash re-reports the
backlog, a file whose last line has no terminator never reports that
line until something appends to it, and `${total}` counts the lines
examined rather than the lines in the file.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Michael Medin <michael@medin.name>
0 commit comments