I have been working to integrate application logs with the ossec logcollector.
I have successfully created, decoded, command, rules etc, and everything works and fires triggers.
However our application rotates logs, and doesn't create log until that particular incident is triggered. And ossec-logcollector would not read new files.
There are various ways I could do but not so ideal.
- Touching files and restarting ossec-logcollector everyday.
- Cronjob to restart ossec-logcollector every 10 min [ok this will again be non-realtime].
- Write script which checks when those files were created and if new restart ossec-logcollector. I haven't figured this out yet, but I think its possible.
- Check for diff using ossec command using wc -l, if there is new files write script as fire rule and restart ossec-logcollector.
But is there any better way of doing this in ossec? Or is there any way to enable ossec-logcollector to check new files too?
I faced the same issue, I suggest the script in bellow, or check if there's a log entry when log retention occur and create decoder/rule/active response based on this entry which restart logcollector
0xFFFFFF