The
localfile module is used to pick events from specific user-defined paths. Depending on which events you want to monitor, you should go to your manager's or agents'
ossec.conf file - or to an agent.conf file if it is an agent
centralized configuration - and set a
localfile module as follows:
<localfile>
<location>/<FILE_PATH>/file.xml</location>
<log_format>syslog</log_format>
</localfile>
Where the location points the path and filename to be monitored.There you can add the multiline-regex option for multiline events. So for example, the previous localfile will look similar to this:
<localfile>
<location>/<FILE_PATH>/file.xml</location>
<log_format>multi-line-regex</log_format>
<multiline_regex match="start">START_EVENT</multiline_regex>
</localfile>
The log_format needs to be multi-line-regex and in the multiline_regex field, you have to define the pattern for your log events. In the previous example, we considered that your events start with the pattern START_EVENT. So each time that a new START_EVENT pattern appears, it will be considered as a new event. Everything within START_EVENT and till the next START_EVENT pattern will be set into a single line so the manager can process it.