Configuration

    Wazuh Log Data Collection with localfile (Complete Guide)

    Collect logs from files, Windows Event Log, journald, command output and syslog using the Wazuh localfile directive.

    WazuGuardix Team June 16, 2026 7 min read

    The Wazuh agent reads logs through the logcollector module. Each source is declared with a <localfile> block in ossec.conf (or in shared agent.conf for group-wide rollouts).

    Plain text log file

    <localfile>
      <log_format>syslog</log_format>
      <location>/var/log/auth.log</location>
    </localfile>

    Windows Event Channel

    <localfile>
      <location>Security</location>
      <log_format>eventchannel</log_format>
      <query>Event/System[EventID=4625 or EventID=4624]</query>
    </localfile>

    systemd journald

    <localfile>
      <log_format>journald</log_format>
      <location>journald</location>
      <filter field="_SYSTEMD_UNIT">^sshd.service$</filter>
    </localfile>

    Command output

    <localfile>
      <log_format>full_command</log_format>
      <command>df -P</command>
      <frequency>360</frequency>
    </localfile>

    JSON logs (auditd, app logs)

    <localfile>
      <log_format>json</log_format>
      <location>/var/log/myapp/app.json</location>
    </localfile>

    Note: After every change restart the agent: systemctl restart wazuh-agent. Use ossec-logtest on the manager to verify decoders match.

    We onboard 100+ log sources (firewalls, EDR, SaaS) into a single Wazuh tenant, contact us for log onboarding.

    Official reference

    Commands and configuration in this guide are based on the official Wazuh documentation. For the canonical source, see:

    WazuhLog Collectionlocalfile

    Need help running Wazuh in production?

    Our team designs, deploys and operates Wazuh end to end, from indexer sizing to custom rules and 24/7 SOC monitoring.