sensu / sensu-check-log

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

Add support for regex paths #10

Closed ValkyrieOps closed 3 years ago

ValkyrieOps commented 3 years ago

It would be helpful to be able to specify a regex path/multiple files to look at, specifically for applications that write logs to dated folders. For example:

C:\Program Files\Application\logs\YYYY-MM-DD\log.txt

Being able to present the check configuration as the following would be nice.

sensu-check-log -log "C:\Program Files\Application\logs\*\*.txt" -match ERROR -state "C:\etc\sensu\log_state\Application"

This was previously accomplished with a modified version of the log plugin for Sensu Core, but given the current Ruby runtime does not support Windows that guy no longer functions.

ValkyrieOps commented 3 years ago

I went ahead and reworked this for my use case using the asset template as a starting point and pulled in what was useful. Hope that's all right. Suggestions are welcome for improvements: https://github.com/ValkyrieOps/sensu-check-log-regex. Can close this out too I suppose.

jspaleta commented 3 years ago

Hey @ValkyrieOps , Of course its all right.

I'm going to be working on updating this to use the plugin SDK this week, reusing some of your regex logic work but keeping the events api logic to generate different events.

If you are interested in working towards deprecating your spin-off and want to eventually use this plugin, please file additional feature requests (after I get this initial refactor done) that bring the two repos into feature parity.

ValkyrieOps commented 3 years ago

Excellent really excited for the new changes! I will take a look at integrating this once that PR goes through. Once that's done I can deprecate the existing repo and delete the Bonsai Asset as well. Cheers