<!--
  Plain log files on a Linux endpoint.
  Goes between the <ossec_config> tags of /var/ossec/etc/ossec.conf,
  or inside <agent_config> in a group's shared agent.conf.

  Options used here are all in the localfile reference:
  https://documentation.wazuh.com/5.0-beta/user-manual/reference/ossec-conf/localfile.html
-->

<!-- One entry per line, the common case. -->
<localfile>
  <log_format>syslog</log_format>
  <location>/var/log/syslog</location>
</localfile>

<!-- auditd: the audit format chains consecutive records with the same ID
     into a single event. Two ignore expressions keep configuration churn out. -->
<localfile>
  <log_format>audit</log_format>
  <location>/var/log/audit/audit.log</location>
  <ignore type="PCRE2">type=.+_CHANGE</ignore>
  <ignore type="osregex">type=CONFIG_\.+</ignore>
</localfile>

<!-- A wildcard over an application directory, skipping binaries and
     anything untouched for a day. The agent monitors at most 1000 files
     at a time across all localfile blocks. -->
<localfile>
  <log_format>syslog</log_format>
  <location>/var/log/myapp/*.log</location>
  <exclude>/var/log/myapp/debug*.log</exclude>
  <ignore_binaries>yes</ignore_binaries>
  <age>1d</age>
</localfile>

<!-- strftime in the path, for an application that rotates by date.
     strftime and wildcards cannot be combined in one entry. -->
<localfile>
  <log_format>syslog</log_format>
  <location>/var/log/myapp/access-%Y-%m-%d.log</location>
</localfile>

<!-- Single-line JSON, with labels added to each event. -->
<localfile>
  <log_format>json</log_format>
  <location>/var/log/portal/audit.log</location>
  <label key="@source">portal</label>
</localfile>

<!-- restrict keeps only the lines you want. ignore takes precedence over
     restrict when a line matches both. -->
<localfile>
  <log_format>syslog</log_format>
  <location>/var/log/myapp/gateway.log</location>
  <restrict type="PCRE2">(denied|rejected)</restrict>
</localfile>
