a2o / snoopy

Snoopy Command Logger is a small library that logs all program executions on your Linux/BSD system.
GNU General Public License v2.0
1.22k stars 155 forks source link

`ERROR: Closing data source tag` in filename of datetime output #270

Closed casesolved-co-uk closed 2 months ago

casesolved-co-uk commented 3 months ago

Checklist before starting to submit this bug report

I confirm that:

Bug description

Got the following file in /var/log when I enabled logging to file with the datetime format:

snoopy.log-[ERROR: Closing data source tag ('}') not found.]

Bug reproduction steps

  1. Ubuntu 20.04.06 LTS (AWS version)
  2. Install using install-snoopy.sh as root (version 2.5.1)
  3. reconfigure to output using: output = file:/var/log/snoopy.log-%{datetime:%Y-%m-%d}
  4. disable and enable snoopy
  5. View file in /var/log

Expected result

Normal filename

Actual result

Strange filename above

bostjan commented 3 months ago

Hey @casesolved-co-uk, thanks for reporting this. By the looks of it, it seems the format parser doesn't correctly recognise the } character, for whatever reason (maybe because it's the last character in a string, and the parser fails to deal with that location correctly), and thus the creation of datetime string fails, resulting in an error. Clearly there are some (quite literally) edge case tests missing here. I'll look into this soon-ish.

bostjan commented 2 months ago

The fix will be released in v2.5.2. Thanks for reporting this issue!