sensu / sensu-check-log

The Sensu Go log file monitoring check plugin and asset.
MIT License
2 stars 3 forks source link

Add -ignore-initial-run flag and update changelog #7

Closed nikkictl closed 4 years ago

nikkictl commented 4 years ago

Signed-off-by: Nikki Attea nikki@sensu.io

Closes https://github.com/sensu/sensu-check-log/issues/5 Closes https://github.com/sensu/sensu-check-log/issues/6

nikkictl commented 4 years ago

@echlebek I used the presence of the state file, rather than the offset, to determine if the plugin is on it's first run. Let me know if this approach is more in line with your suggestion.

nikkictl commented 4 years ago

I worry it doesn't address the number of matches described in https://github.com/sensu/sensu-check-log/issues/6#issue-670043426 though. We'd have to read through the log file to determine the initial matches.

nikkictl commented 4 years ago

I've set the state file's offset on the first run with -ignore-initial-run to the size of the log file. This optimizes the initial run since we don't have to read and analyze it, and configures the offset to the proper starting point for subsequent runs.