Enriching Wazuh alerts with an LLM

Add LLM-generated context to Wazuh YARA alerts through an active response script, control what leaves your host, and swap the public API for a self-hosted model.

On this page

How Wazuh alert enrichment with an LLM works

Wazuh can call a language model after a YARA match and attach the reply to the alert, but only as a vendor proof of concept, not a supported product feature. The pattern is a custom active response script. File integrity monitoring (FIM) rules trigger the script when a YARA rule matches a changed file. The script sends a prompt to a model API, receives the answer and stores it in the alert field yara.chatgpt_response. The documented example uses OpenAI's gpt-4-turbo and caps each response at 256 tokens, so the model output is short and bounded by design. Teams should treat the example as a starting point they must own, test and maintain, not as a finished feature they can enable.

The prompt is built from the description field of the matched YARA rule, so the quality of the summary depends on the quality of the rule metadata. Custom YARA rules without a description give the model little to work with, and the enrichment will be vague or misleading. Before building anything, the team should review its rule set, add clear descriptions that explain what the rule detects and why it matters, and decide which fields the script will send. Every field in the prompt leaves the host, so the description must not contain secrets, internal hostnames or sensitive context that the organization would not share with a third party. Confirm the current content of the proof of concept against the Wazuh proof-of-concept guide, since the example may change between Wazuh releases.

What you need before enabling LLM enrichment

The enrichment pattern depends on a few pieces working together: a known Wazuh version, file integrity monitoring that actually produces YARA matches, rules that carry the context a model needs, and a model endpoint the Wazuh server host can reach. Check each item before writing the active response script, because a gap in any one of them produces alerts that look enriched but carry no useful answer.

Confirm the Wazuh 4.14 release line

The vendor proof of concept is written against the current 4.14 release line, and the 4.14 series has had several patch releases in 2026, so the exact patch level matters. Confirm the version you run against the Wazuh release notes before you copy any script or configuration, and pin that version in your change record. Check that the active response and integrator behavior you rely on is unchanged in your target patch level, and retest after every upgrade.

Wazuh release notes

Working FIM and YARA on hosts

The proof of concept triggers enrichment from file integrity monitoring rules, so the monitored hosts must have agents enrolled, FIM directories configured, and YARA scanning wired to the rules that fire on new or changed files. Test with a harmless file that matches a known YARA rule and confirm the alert appears in the dashboard before adding any model call. Without a reliable trigger, you cannot tell whether a missing enrichment is a model problem or a detection problem.

Custom YARA rules with descriptions

The enrichment prompt is built from the description field of the matched YARA rule, so a rule without one sends the model almost no context. Review every custom rule in your ruleset and add a clear, specific description that states what the rule detects and why it matters. Treat the description as data you control: it is sent to the model, so it should not contain secrets, internal hostnames or sensitive operational detail.

An LLM endpoint and its credentials

Decide which model serves the prompts before writing the script. A public API requires an API key stored outside the script, with a dedicated key, a spending limit and a named owner. A self-hosted endpoint needs its own access control, because some serving engines expose their API without authentication by default and protect only part of their routes. Record where the key lives, who can rotate it, and what happens when it is revoked.

Outbound network rules for the API

The Wazuh server or agent host that runs the active response script must reach the chosen API endpoint, and nothing else should be able to. Document the destination hostname and port, allowlist it at the firewall or proxy, and confirm whether the script runs on the agent or on the server, because that changes which host needs the route. For a public API, confirm the provider's current hostname with the provider. For a self-hosted model, the route stays inside your network.

A review of what leaves the host

Before enabling enrichment, decide what data goes to the model: the rule description, the alert fields, and any file content or excerpt the script includes. Each field is a disclosure decision that your data protection and compliance owners should approve in writing. Write down the exact payload the script builds and test it with a sample alert, so the approved content matches what the script sends.

Configuring the active response and YARA pipeline

This sequence turns a YARA match on a monitored directory into a Wazuh alert that carries a model-generated summary. Each step ends with a check so you can confirm the pipeline works before any production file changes trigger it.

  1. Confirm YARA rules and monitored directories

    On the Wazuh manager, confirm which YARA rule files are loaded and that each custom rule includes a description field, because the enrichment prompt reads that field. Then confirm which directories the agent watches through file integrity monitoring and which of those are covered by YARA scanning. Check the result by running a test file that matches a rule in a watched directory and seeing the YARA alert appear in the dashboard. If the alert does not show a description, fix the rule before going further.

  2. Write the custom active response script

    The platform engineer writes a script that reads the alert from Wazuh, extracts the matched YARA rule description and file context, and sends a request to the model API with a token cap. The vendor proof of concept uses OpenAI's gpt-4-turbo and caps the response at 256 tokens. Keep the script minimal, log each request with the alert ID, and store the API key outside the script in a file readable only by the service account. Check the result by running the script by hand against a saved alert and confirming it prints a response.

  3. Register the command and active response block

    Place the script in the active response directory on the manager and register it with a command block in the manager's ossec configuration. Add an active-response block that names the command and sets when it runs, and set the location to the manager or agent that should execute it. Restart the manager so the change takes effect. Check the result by confirming the manager starts cleanly and the command appears in the configuration when you list it.

  4. Bind the script to the FIM rules that fire on YARA matches

    Create a rule that matches the YARA alerts produced when a file in a monitored directory hits a YARA rule, and link that rule to the active response block by rule ID. Limit the binding to the rule group you intend, so unrelated alerts do not run the model call. Check the result with a test alert: the active response log on the agent or manager should record that the command ran for the matching rule ID.

  5. Set the model name and token cap

    Set the model name and maximum output tokens as explicit values in the script or a separate configuration file, not hardcoded in several places. Record which model version was used, since the enrichment depends on that choice and the API provider may change model availability. Confirm with your security and privacy team which data fields the script sends before you enable it. Check the result by reviewing the configuration file and confirming a single source of truth for both values.

  6. Test with a benign file and verify the stored field

    Create a harmless test file that matches a YARA rule you wrote for testing, drop it into a monitored directory, and wait for the alert. Search the Wazuh indexer for the alert and confirm the model response is stored in the expected field, for example yara.chatgpt_response in the proof of concept. Check the active response log for the request, its status and any error. Remove the test file and confirm the enrichment appears in the dashboard alert view before you widen the rule scope.

Where alert data travels during enrichment

The flow starts on the monitored host, where the Wazuh agent reports a file change under a monitored path. The Wazuh server matches the file against a custom YARA rule and triggers an active response script, which runs on the Wazuh server and builds a prompt from the rule's description field and the matched event. The script then sends that prompt across the trust boundary to a model endpoint, and the answer is written back to the alert as yara.chatgpt_response. Check exactly which fields leave the network, and whether the endpoint is public or self-hosted.

Data path from file change to enriched alert, with the trust boundary around the model endpoint.

What gets sent off-host and why it matters

The first thing to settle is what leaves your environment. In the Wazuh proof of concept, the enrichment script builds its prompt from the description field of the matched YARA rule, and it sends that text to the model API. Any additional alert context the script adds, such as file paths, hostnames, agent names or a fragment of the scanned file, would also leave the network if the script includes it. The proof of concept documents the rule description as the prompt input. It does not give a complete list of everything the script can send, so do not assume the payload is limited to that field. Open the script you deploy, find every variable that is concatenated into the request body, and write the list down before the first alert fires.

Once you have the list, minimize it. Remove any field that the analyst does not need to understand the match, and prefer rule descriptions that name the behavior without revealing internal project names, customer identifiers or paths that map to sensitive systems. If the enrichment needs file context, decide whether a short excerpt is worth the exposure, and if it is, cap its length and redact secrets before the request is built. Keep the YARA rule descriptions themselves reviewed, because custom rules written by different engineers can contain internal detail that was never meant for a third party. Confirm the exact fields by inspecting the script and by testing with a sample alert, not by relying on this page.

Then decide whether your data classification allows a public API at all. If alerts from the monitored hosts can contain regulated, customer or secret-bearing data, a public model endpoint is usually a governance decision for the data owner and the security team, not an engineering default. The alternative is a self-hosted model reached over a network you control, which moves the question to where that model runs and who can reach it. Ask your compliance lead which data classes are permitted at the public provider, record the decision with the alert types it covers, and confirm that the answer still holds after any rule or script change.

Public API or self-hosted model for enrichment

The proof of concept calls OpenAI's gpt-4-turbo from a custom active response script triggered by FIM rules, and stores the answer in yara.chatgpt_response with responses capped at 256 tokens. This is the fastest path to a working result because the provider runs the model, and your team only manages the script and the API key. The trade-off is that the matched YARA rule description, and any file context your prompt includes, are sent to a third party on every alert.

  • Off-host data: Each prompt leaves your infrastructure, so the content of matched files may reach the provider depending on what the script includes.
  • Recurring cost: Usage is billed per request and token, so alert volume from file integrity monitoring drives the bill.
  • Key handling: The API key must be stored on the agent or manager host and rotated, which adds an operational duty.
  • Contract terms: Retention, training use and data location depend on the provider agreement, which your legal and procurement teams should review.
  • Outbound access: The endpoint needs egress to the provider, which may conflict with an air-gapped or tightly filtered network.

Before approving this option, confirm the provider's current data handling terms and whether your classification policy allows the matched content to leave your environment.

Securing the model endpoint and the enrichment script

The enrichment pipeline has three weak points: the model endpoint, the credentials that reach it, and the active response script that sends alert data off the host. Each card below names a control and a check to run before the script handles production alerts.

Protect vLLM beyond its API key

The --api-key option does not protect every endpoint in vLLM. It covers the /v1, /v2, /inference and /cohere paths, but not /invocations, /pause, /resume, /abort_requests, /metrics or /health. The vLLM security docs recommend a reverse proxy that allowlists only the paths the enrichment script calls, such as the chat completions path, and blocks everything else. Test the proxy from a host outside the script's allowed sources to confirm that the admin and metrics paths return errors.

vLLM security docs

Bind Ollama deliberately

Ollama's local API at port 11434 has no authentication, and it binds to 127.0.0.1 by default. If the script runs on another host, set the bind address with OLLAMA_HOST, then restrict access at the network layer or through a proxy that adds authentication. Confirm with a port scan from a second host that the API is reachable only from the Wazuh server or the script's host.

Ollama FAQ

Keep cloud features off

If prompts and alert data must stay on your infrastructure, set OLLAMA_NO_CLOUD=1 in the server environment or the server configuration file, then confirm that the server does not reach out for cloud models. Ollama's cloud inference at ollama.com requires an API key, so a script that falls back to a hosted endpoint would send alert content off-host. Record the setting in your configuration management so that a rebuilt server keeps it.

Ollama FAQ

Store API keys outside the script

Keep the model API key out of the active response script and out of the Wazuh rules, decoders and shared configuration. Place it in a root-owned environment file or a secrets manager that the agent's active response user can read, and limit that file to the account that runs the script. Rotate the key on a schedule and after any staff change, and check that the key does not appear in the Wazuh logs or the yara.chatgpt_response field.

Restrict who edits active response scripts

Active response scripts run with the privileges the agent grants them, so an edit to the script is an edit to code that runs on endpoints. Limit write access to the script directory and to the file that defines the trigger rules to a named group, keep those files under version control, and require review before deployment. Confirm which account executes the script on each agent, because that account sets the damage a tampered script could do.

Keep secrets out of the prompt

The prompt uses the description field of the matched YARA rule, along with alert content such as file paths and matched strings. Those fields can contain hostnames, internal paths, customer identifiers or fragments of credentials that a file contains. Review what the script includes in each request, strip or hash sensitive fields before sending, and check that the prompt template contains no credentials. Written review of the prompt is part of the data handling record for the model provider.

Fields the enrichment reads and writes

This table maps each piece of the enrichment flow to the field or setting it depends on, from the YARA rule description to the dashboard view where analysts read the answer. Use it to check your own configuration before you test, since field names outside the vendor guide must be confirmed against your alert output.

ElementWhere it appearsWhat to confirm
YARA rule descriptionCustom YARA rule metadata, read into the promptEvery custom rule has a description, because the vendor guide builds the prompt from it
FIM alert triggerFile integrity monitoring rule that fires the active responseThe rule ID and group that match your YARA hit alerts in alerts.json
Active response scriptCustom script on the server that calls the model API after the triggerThe script name, arguments and timeout match what the agent and manager expect
Model name settingScript configuration in the enrichment scriptThe model identifier matches the endpoint you call, and you have tested it against your own key or host
Response token capScript configuration, set to 256 tokens in the vendor proof of conceptAnswers are not truncated in a way that hides the recommended action
Stored answer fieldyara.chatgpt_response in the alert documentThe exact field path in your indexer, since names outside the vendor guide may differ in your version
Dashboard viewWazuh dashboard alert or Discover view filtered on the enrichment fieldAnalysts can filter on the field and see it on the alert details page for each affected host

Questions teams ask before enabling LLM enrichment

What does LLM enrichment cost to run on Wazuh alerts?

The cost depends on which model you call. With a public API, you pay the provider for the tokens each request uses, which recurs with alert volume. The Wazuh proof-of-concept caps each response at 256 tokens, which limits output size per alert but not the number of calls. With a self-hosted model, the main costs are accelerator capacity (GPUs or other hardware), the servers around them, and the people who operate the stack. vLLM and Ollama have no license fee to pay, so the hardware and staff time are the real spend. Hardware and staff time are mostly recurring, while the initial build, script and testing work is one-time. Ask any partner for a written quote that separates these lines and states how alert volume was assumed.

How long does a pilot of LLM alert enrichment take?

The duration depends on how many detection rules you enrich, whether your custom YARA rules already have good descriptions, and whether you call a public API or a self-hosted model. A pilot limited to one FIM rule set using a public API is much smaller than a pilot that also builds and sizes a GPU serving stack. The Wazuh guide uses FIM-triggered YARA matches as its starting point, so scoping the first pilot to that path keeps the work narrow. Confirm the timeline in writing before work starts, and ask for it to list the rules in scope, the test alerts used for validation and the acceptance criteria.

Can our own team build LLM enrichment for Wazuh without outside help?

Yes, a team that already runs Wazuh and can write and test shell or Python active response scripts can build the proof-of-concept pattern. The skills needed are Wazuh rule and active response configuration, YARA rule authoring, API client code and secure handling of credentials. Self-hosting adds Linux, GPU driver, container or Kubernetes, reverse proxy and monitoring skills. Teams often find the hardest parts are not the script but the review of what data leaves the host, the handling of model errors and timeouts, and the change control around a script that runs on every matching alert. An outside partner can take on any of these as a fixed-scope piece, and your team keeps ownership of the rules.

What alert data leaves the Wazuh host when a public model API is used?

The script sends whatever it puts in the prompt. In the Wazuh guide the prompt is built from the description field of the matched YARA rule, so a rule description that names internal systems, hostnames or client details would leave the host in every request. Matched file content, file paths, hashes or alert fields can leave too if the script adds them. To limit exposure, write neutral rule descriptions, decide which fields the script may include, strip paths and identifiers you do not need, avoid sending file contents, and log each outbound request. Check your provider's data retention terms and your contract before sending any production alert data, and confirm with your security and legal teams.

Does Wazuh support a custom LLM active response script in production?

The Wazuh LLM enrichment material is a proof-of-concept guide, so treat the script as your own code, not a supported product feature. Wazuh's licensing is GNU General Public License version 2 with an OpenSSL linking exception, so you may modify the software, but the support obligations for your script sit with your team or your partner. Before production use, confirm with Wazuh which support tier, if any, covers custom active response content, and test the script against each Wazuh 4.14 patch release you deploy, since the release line has had several patch releases in 2026.

When should we self-host the model instead of calling a public API?

Self-host when alert content or prompts must stay inside your infrastructure, when your policy does not allow a third-party API for this data, or when you need predictable control over model versions. Ollama states that when it runs locally it does not see your prompts or data, and its local API at localhost:11434 requires no authentication by default, so it must be placed behind access controls. vLLM offers OpenAI-compatible endpoints, so a script written for a public API can often point at it after testing. Self-hosting shifts cost from per-call fees to recurring hardware and operations, and it adds security work for the serving endpoint, including the vLLM guidance to place a reverse proxy in front of user-facing endpoints.

What should we check before a self-hosted model goes near Wazuh alerts?

Check the endpoint, the network and the model's behavior. Confirm the serving endpoint is reachable only from the Wazuh server or a dedicated active response path, and that it is not exposed through an allowlist-free proxy. For vLLM, note that the --api-key option does not cover every endpoint, so an allowlisting reverse proxy is needed. For multi-node vLLM, the docs state node-to-node communication is insecure by default, so place nodes on an isolated network. Monitor request counts and latency from the Prometheus-format metrics at /metrics, and set timeouts in the script so a slow model cannot stall alerting. Ask any partner to show these checks in their written scope.

How DeployOpen scopes and delivers LLM enrichment for Wazuh

DeployOpen starts with a written scope because the choices that matter for LLM enrichment are made before any script is written. The scope names the YARA rules that will trigger enrichment, and it requires each rule to carry a description field, since the Wazuh proof-of-concept prompt reads that field. It also records exactly which data may leave the host, whether that is the matched rule metadata, a file excerpt, or nothing beyond the alert identifier. The model endpoint is chosen in the same document: a public API such as the OpenAI endpoint used in the vendor example, or a self-hosted model that keeps prompts inside the client's network. A quote follows from this written scope, so the client sees the cost drivers before work begins.

Once the scope is agreed, DeployOpen implements the active response script, the FIM-triggered rule chain, and the write-back of the model answer into the alert fields. If the client chooses a self-hosted model, DeployOpen deploys it inside the client's own cloud accounts, data centers or air-gapped network, with access control, logging and data handling settings that the client's security and compliance teams can review. Before go-live, DeployOpen security tests the endpoint and the script together: it checks whether the model API is reachable beyond the intended hosts, whether the script's credentials are exposed, and whether a crafted file name or file content can steer the model output. The test plan agreed in the scope defines what is retested after fixes.

After go-live, retainer support can cover script maintenance, model version changes, rule updates and periodic retesting of the endpoint. Teams that are unsure how much of this they need should confirm with the platform owners which Wazuh and model server releases they will run, since both change frequently. DeployOpen does not issue audit reports or certifications for the resulting setup; independent assessors do that work, and DeployOpen supplies the configuration and evidence those assessors ask for. DeployOpen is not a vendor partner of Wazuh, OpenAI or the model runtimes named in this guide.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.