#39120·wazuh

macOS agent log rotation creates an empty ossec-DD.json.gz every day even though JSON logging is disabled

Author: RebitsCreated Sep 10, 2026Updated Oct 1, 2026
Labelstype/bugreporter/qalevel/task

Description

The macOS agent ships with <logging><log_format>plain</log_format></logging>, so it never writes a JSON internal log and /Library/Ossec/logs/ossec.json does not exist. The daily rotation nevertheless produces a compressed archive for that non-existent JSON log alongside the real one, so every rotated day leaves behind an empty ossec-DD.json.gz that decompresses to zero bytes.

A Linux agent from the same build, with the byte-identical <logging> stanza, rotates only the plain log and creates no .json.gz. The behaviour is therefore specific to the macOS agent's rotation path, not a shared consequence of the configuration.

The impact is small: one empty archive per rotated day, plus a misleading artefact that suggests JSON logging is active when it is not, and that would make an operator grepping the rotation directory believe a JSON log was captured and then lost.

Environment

  • Demo environment wqa-prod-58-demo-environment, clustered managers (master + worker), single indexer, single dashboard.
  • Agent under test: demo-env-macos-agent, id 006, macOS 26.5.1 (build 25F80), arm64, Parallels VM on MacStadium host macstadium_arm_4.
  • Agent package: wazuh-agent-5.0.0-latest.arm64.pkg from nightly-backup/2026-09-09, receipt com.wazuh.pkg.wazuh-agent version 5.0.0.
  • Agent VERSION.json: {"version": "5.0.0", "stage": "rc1", "commit": "2161e69"}.
  • Control agent: demo-env-linux-deb-amd64-agent, id 002, Ubuntu 26.04, wazuh-agent_5.0.0-latest_amd64.deb from the same nightly.

Steps to reproduce

  1. Install the 5.0.0 macOS agent package on a macOS host and enroll it. Leave the default logging configuration in place: sudo grep -A3 "<logging>" /Library/Ossec/etc/ossec.conf shows only plain.
  2. Confirm no JSON log is being written: sudo ls -la /Library/Ossec/logs/ossec.json returns No such file or directory.
  3. Leave the agent running across a midnight rotation boundary.
  4. List the rotation directory: sudo ls -la /Library/Ossec/logs/wazuh/<year>/<Mon>/.
  5. Decompress the JSON archive: sudo sh -c 'gzip -dc /Library/Ossec/logs/wazuh/<year>/<Mon>/ossec-<DD>.json.gz | wc -c'.
  6. Repeat steps 1 to 5 on a Linux agent of the same build to compare.

Expected

Rotation archives only the logs that the configured log_format actually produces. With plain configured, only ossec-DD.log.gz is created, matching the Linux agent's behaviour.

Actual

An empty JSON archive is created next to the real one:

=== ossec.json present? ===
ls: /Library/Ossec/logs/ossec.json: No such file or directory
=== all files in logs tree ===
-rw-rw----  1 wazuh  wazuh  40825 Sep 10 05:54 /Library/Ossec/logs/ossec.log
-rw-r-----  1 wazuh  wazuh  20 Sep 10 00:00 /Library/Ossec/logs/wazuh/2026/Sep/ossec-09.json.gz
-rw-r-----  1 wazuh  wazuh  7020 Sep 10 00:00 /Library/Ossec/logs/wazuh/2026/Sep/ossec-09.log.gz
-rw-rw----  1 wazuh  wazuh  0 Sep  8 19:28 /Library/Ossec/logs/active-responses.log
=== json.gz decompressed size ===
       0
=== logging stanza ===
  <logging>
    <log_format>plain</log_format>
  </logging>

Control, Linux agent 002, same build and same <logging> stanza, no .json.gz produced:

=== Linux rotated log dir ===
-rw-r----- 1 wazuh wazuh 4024 Sep 10 00:00 /var/ossec/logs/wazuh/2026/Sep/ossec-09.log.gz
=== json.gz content size ===
gzip: /var/ossec/logs/wazuh/2026/Sep/*.json.gz: No such file or directory

Not a duplicate of

qa-known-issues.py check scored four cache candidates and one live-search result, none of them this defect:

  • wazuh/wazuh#14240 "Error when building agent in macOS 11 and higher" (0.50) is a macOS build failure, unrelated to rotation.
  • wazuh/wazuh#10901 "Issue with GitLab JSON log ingestion on Filebeat" (0.40) concerns ingestion of a monitored third-party JSON log, not the agent's own internal log rotation.
  • wazuh/wazuh#3477 "Contradictory Windows agent log messages" (0.38-0.40) is about the content of Windows log messages, a different platform and a different symptom.
  • wazuh/wazuh#10670 "Investigate the log message wazuh-modulesd: WARNING: Empty group for agent ID 'X'" (0.38) is a specific modulesd warning, unrelated to rotation artefacts.
  • The live search returned wazuh/wazuh#3150 "Deprecate/remove internal options file", which is about internal_options.conf deprecation, not rotation output.