Skip to content

Wazuh agent

60 commands

The endpoint agent for the open-source Wazuh SIEM/XDR: log collection, file-integrity monitoring and vulnerability detection.

  • SIEM
  • XDR
  • file integrity

Install Wazuh agent

See https://documentation.wazuh.com/current/installation-guide/wazuh-agent/

Service Management5

systemctl start wazuh-agent

Starts the Wazuh agent service on a Linux endpoint using systemd.

systemctl stop wazuh-agent

Stops the Wazuh agent service on a Linux endpoint to halt monitoring.

systemctl restart wazuh-agent

Restarts the Wazuh agent service to apply configuration changes.

systemctl status wazuh-agent

Displays the current operational status and recent logs of the Wazuh agent service.

/var/ossec/bin/wazuh-control info

Provides version information and build details of the installed Wazuh agent.

Service Management (Windows)1

net start WazuhSvc

Starts the Wazuh agent service on a Windows endpoint using the command line.

Service Management (Legacy)1

/var/ossec/bin/wazuh-control start

Manually starts the agent processes using the internal control script.

Agent Registration5

/var/ossec/bin/agent-auth -m <MANAGER_IP>

Registers the agent with the Wazuh manager using the manager's IP address.

Link
/var/ossec/bin/agent-auth -m <MANAGER_IP> -A <AGENT_NAME>

Registers the agent with a specific custom name instead of the hostname.

Link
/var/ossec/bin/agent-auth -m <MANAGER_IP> -P <PASSWORD>

Registers the agent using a password for authentication with the manager.

Link
/var/ossec/bin/agent-auth -m <MANAGER_IP> -G <GROUP>

Registers the agent and immediately assigns it to a specific configuration group.

Link
/var/ossec/bin/agent-auth -m <MANAGER_IP> -v <CERT_PATH> -k <KEY_PATH>

Registers the agent using SSL/TLS certificates for mutual authentication.

Link

Key Management3

/var/ossec/bin/manage_agents -i <KEY_STRING>

Manually imports a pre-generated authentication key on the agent.

Link
cat /var/ossec/etc/client.keys

Displays the contents of the client keys file to verify registration status.

Link
rm /var/ossec/etc/client.keys

Removes the client key file to force re-registration of the agent.

Link

Configuration Handling3

/var/ossec/bin/verify-agent-conf

Checks the ossec.conf file for syntax errors before restarting the service.

Link
grep '<manager_address>' /var/ossec/etc/ossec.conf

Verifies the configured Wazuh manager IP address in the configuration file.

Link
sed -i 's/<protocol>udp/<protocol>tcp/' /var/ossec/etc/ossec.conf

Switches the agent transport protocol from UDP to TCP via command line.

Link

Log Collection3

tail -f /var/ossec/logs/ossec.log

Monitors the Wazuh agent's internal operational log in real-time.

Link
grep 'Error' /var/ossec/logs/ossec.log

Filters the internal log file for error messages to troubleshoot issues.

Link
tail -f /var/ossec/logs/active-responses.log

Monitors the execution log of active response scripts on the endpoint.

Link

Network Monitoring2

netstat -vatn | grep 1514

Verifies if the agent has an established TCP connection to the manager on port 1514.

Link
tcpdump -i any port 1514

Captures network packets on port 1514 to debug connectivity issues with the manager.

Link

FIM Actions3

/var/ossec/bin/syscheck_update -l

List synchronized files in the FIM database (if local tool is enabled).

Link
touch /etc/test_fim_file

Creates a test file to validate if File Integrity Monitoring is triggering alerts.

Link
echo 'modification' >> /etc/test_fim_file

Modifies a monitored file to verify FIM modification detection.

Link

Active Response3

ls -l /var/ossec/active-response/bin/

Lists available active response scripts executable by the agent.

Link
/var/ossec/active-response/bin/host-deny.sh add - <IP_ADDRESS>

Manually triggers the host-deny active response script to test IP blocking.

Link
/var/ossec/active-response/bin/firewall-drop.sh delete - <IP_ADDRESS>

Manually removes a firewall block created by the firewall-drop active response.

Link

Process Monitoring3

ps aux | grep wazuh-agentd

Checks if the main agent daemon process is running.

Link
ps aux | grep wazuh-logcollector

Verifies that the log collector process is active and running.

Link
ps aux | grep wazuh-syscheckd

Verifies that the FIM (syscheck) daemon is active and running.

Link

Troubleshooting (Debug)2

echo 'wazuh_modules.debug=2' >> /var/ossec/etc/local_internal_options.conf

Enables verbose debug logging for Wazuh modules in the internal options file.

Link
echo 'agent.debug=2' >> /var/ossec/etc/local_internal_options.conf

Enables verbose debug logging specifically for the agent communication process.

Link

Validation & Testing2

logger 'Test Wazuh Alert'

Generates a syslog message to test if the log collector is reading syslog.

Link
cat /etc/shadow

Simulates a read of a sensitive file to test access monitoring rules.

Link

Validation & Testing (Windows)1

eventcreate /ID 1 /L Application /T INFORMATION /SO 'WazuhTest' /D 'Test Log'

Creates a dummy Windows Event Log entry to verify Windows log collection.

Link

Advanced Config1

sed -i 's/<disabled>yes/<disabled>no/' /var/ossec/etc/ossec.conf

Enables a disabled module (like SCA or Syscollector) via command line stream editor.

Link

Rootcheck1

/var/ossec/bin/wazuh-control restart

Restarts the agent, which forces a rootcheck and syscheck scan based on default frequency.

Link

Queue Management2

ls -lh /var/ossec/queue/rids/

Checks the size of the request ID queue files to monitor for queue corruption.

Link
rm /var/ossec/queue/rids/sender_counter

Resets the sender counter if the agent falls out of sync with the manager (use caution).

Link

Performance Tuning2

echo 'syscheck.sleep=2' >> /var/ossec/etc/local_internal_options.conf

Adjusts the sleep time between FIM file checks to reduce CPU usage.

Link
echo 'logcollector.queue_size=1024' >> /var/ossec/etc/local_internal_options.conf

Increases the log collector queue size to handle high-volume log bursts.

Link

Automation1

grep -q 'Client version' /var/ossec/logs/ossec.log && echo 'Upgraded'

Scriptable check to verify if an agent upgrade has completed successfully.

Link

Docker Monitoring1

usermod -aG docker wazuh

Adds the wazuh user to the docker group so the agent can monitor Docker events.

Link

Auditd Integration2

auditctl -w /etc/passwd -p wa -k identity

Adds a Linux audit rule to watch /etc/passwd, which Wazuh can then ingest.

Link
cat /var/log/audit/audit.log

Verifies that the audit log exists and is populated for Wazuh to read.

Link

System Inventory1

sqlite3 /var/ossec/queue/syscollector/db/local.db 'SELECT * FROM packages LIMIT 5;'

Directly queries the local Syscollector SQLite database to view inventory data.

Link

Clean Uninstall3

yum remove wazuh-agent

Uninstalls the Wazuh agent package on RHEL/CentOS systems.

Link
apt-get purge wazuh-agent

Uninstalls and removes configuration files for the Wazuh agent on Debian/Ubuntu.

Link
rm -rf /var/ossec

Manually removes the installation directory to ensure a completely clean slate.

Link

Connectivity Test1

nc -zv <MANAGER_IP> 1514

Uses Netcat to test if the manager's registration/event port is reachable.

Link

Log Perms1

chmod 644 /var/log/custom_app.log

Ensures a custom log file is readable by the Wazuh agent user for collection.

Link

Packet Capture1

tcpdump -w wazuh_debug.pcap -s 0 host <MANAGER_IP> and port 1514

Captures full packets to/from manager for advanced protocol analysis in Wireshark.

Link

Advanced Debug2

strace -p $(pidof wazuh-agentd)

Traces system calls of the running agent daemon to debug hangs or crashes.

Link
lsof -p $(pidof wazuh-logcollector)

Lists all files currently open by the log collector to verify file handles.

Link

Status Check1

/var/ossec/bin/agent_control -l

Lists active agents (Note: This is a manager command but useful in hybrid testing).

Link

Policy Validation1

/var/ossec/bin/rootcheck_control -i 001

Queries rootcheck database for agent 001 (Manager side command for validation).

Link

Agent Upgrade1

/var/ossec/bin/agent_upgrade -a 001 -f <package_path>

Forces a remote upgrade of agent 001 from the manager (WPK file required).

Link

Cleanup1

systemctl disable wazuh-agent

Disables the Wazuh agent from starting automatically on system boot.

Link