Logging
The Wazuh manager generates and stores operational logs in the /var/wazuh-manager/logs/ directory. Rotated wazuh-manager.log and wazuh-manager.json files are kept for 31 days by default. To change this retention period, set the wazuh_modules.manager_task_log_keep_days option in the /etc/wazuh-manager/wazuh-manager-internal-options.conf file.
The table below describes the log files and their storage location on the Wazuh manager.
Log storage file |
Description |
|---|---|
|
Stores all Wazuh manager logs in plaintext. |
|
Stores all Wazuh manager logs in JSON. |
|
Stores the Wazuh manager API logs in plaintext. |
|
Stores the Wazuh manager API logs in JSON. |
|
Stores all Wazuh cluster logs in plaintext. |
Configuration
The following <logging> block represents the default logging configuration in the Wazuh manager /etc/wazuh-manager/wazuh-manager.conf file:
<wazuh_config>
...
<logging>
<log_format>plain</log_format>
</logging>
...
</wazuh_config>
Where:
The
<log_format>specifies the format of internal logs (JSON or plaintext). The default value isplainfor plaintext logs. The allowed values areplain,json, andplain,json.The
<logging>block configures logs written by Wazuh manager daemons and the Wazuh normalization engine, includingwazuh-manager.logandwazuh-manager.json. It does not affect Wazuh manager API logs.
Log compression and rotation
Log files can quickly accumulate and consume significant disk space on the Wazuh manager endpoint. The Wazuh manager compresses logs during rotation to reduce disk usage and maintain system performance.
The Wazuh manager rotates wazuh-manager.log and wazuh-manager.json daily, shortly after midnight, and whenever either file exceeds 512 MB. By default, it compresses rotated files with gzip and retains them for 31 days. The files are stored in /var/wazuh-manager/logs/wazuh/<YEAR>/<MONTH>/ with the names wazuh-<DAY>.log.gz and wazuh-<DAY>.json.gz. If a file rotates more than once in a day, the Wazuh manager appends a -<NNN> counter to each additional filename.
The Wazuh manager API and cluster daemons rotate api.log and cluster.log daily at midnight. Each daemon creates a new file with the original filename and continues writing to it. The Wazuh manager does not delete the rotated api.log and cluster.log files.
The Wazuh manager API can also rotate api.log based on file size. Configure this behavior with the logs.max_size option in /var/wazuh-manager/api/configuration/api.yaml.
Each daemon stores the compressed api.log and cluster.log files in nested directories in the format .../<FILENAME>/<YEAR>/<MONTH>/, where:
The
<FILENAME>indicates the name of the original log file.The
<YEAR>indicates the year of the logged entries.The
<MONTH>indicates the month of the logged entries, as a three-letter abbreviation such asJun.
For example, the log file /var/wazuh-manager/logs/cluster.log for June 1, 2026 is compressed after midnight and stored in the /var/wazuh-manager/logs/cluster/2026/Jun/ directory. You can list the contents of the directory by executing the command below:
# ls -la /var/wazuh-manager/logs/cluster/2026/Jun/
The command output looks similar to this:
total 24
drwxr-x--- 2 wazuh-manager wazuh-manager 4096 Jun 2 09:13 .
drwxr-x--- 3 wazuh-manager wazuh-manager 4096 Jun 2 09:13 ..
-rw-r----- 1 wazuh-manager wazuh-manager 12728 Jun 2 09:13 cluster.log-01.gz
The Wazuh manager appends the suffix -<DAY_OF_THE_MONTH>, the day of the logged entries, to the original filename as the output shows (cluster.log-01.gz).
The wazuh_modules.manager_task_log_* internal options in the /etc/wazuh-manager/wazuh-manager-internal-options.conf file control the rotation schedule, size threshold, compression, daily rotation slots, and retention period of the wazuh-manager.log and wazuh-manager.json files. The Wazuh manager reads these options when it starts, so restart the Wazuh manager after you change them. For example, add wazuh_modules.manager_task_log_keep_days=7 to keep rotated files for 7 days.
The following table lists the options, their default values, and their allowed values.
Option |
Default |
Allowed values |
Description |
|---|---|---|---|
|
1 |
0 - 1 |
Turns log rotation on (1) or off (0). 0 turns off both the daily and the size-based rotation. |
|
512 |
0 - 4096 |
Size, in MB, at which a log file is rotated. 0 turns off size-based rotation and keeps the daily rotation. |
|
1 |
0 - 1 |
Compresses rotated files with gzip (1) or keeps them uncompressed (0). |
|
12 |
1 - 256 |
Maximum number of rotated files per day for each log file. |
|
10 |
1 - 600 |
Seconds after local midnight at which the daily rotation runs. |
|
31 |
0 - 500 |
Number of days to keep rotated files. 0 keeps none. |
You can configure the removal of compressed files after a specified period to suit your needs. You can move them to log management systems, backup servers, or cloud-based storage devices for longer-term retention.