Skip to main content
The main plugin (wazuh) is the primary plugin that provides the Wazuh dashboard application, UI components, and server-side routes.

Plugin Class

WazuhPlugin

The main plugin class implementing the OpenSearch Dashboards plugin interface. Location: plugins/main/public/plugin.ts:51

Lifecycle Methods

setup()

Initializes the plugin during the setup phase. Signature:
CoreSetup
required
OpenSearch Dashboards core services setup contract
WazuhSetupPlugins
required
Plugin dependencies available during setup
Returns: Promise<WazuhSetup> - Empty object (no public APIs exposed during setup)

Setup Tasks

During setup, the plugin:
  1. Configures chart color palettes - Customizes the EUI palette for better visualization
  2. Registers query languages - Enables WQL, Lucene, and DQL for search bars
  3. Registers applications - Creates all Wazuh applications (Overview, Agents, etc.)
  4. Registers navigation links - Adds Wazuh to the OpenSearch Dashboards menu
Example:

start()

Activates the plugin during the start phase. Signature:
CoreStart
required
OpenSearch Dashboards core services start contract
WazuhStartPlugins
required
Plugin dependencies available during start
Returns: WazuhStart - Empty object (no public APIs exposed during start)

Start Tasks

During start, the plugin:
  1. Sets global services - Makes core services available throughout the app
  2. Hides security alerts - Disables OpenSearch security warnings
  3. Initializes telemetry - Sets up usage tracking if enabled
  4. Configures error handling - Establishes error orchestration
Example:

Type Definitions

WazuhSetupPlugins

Plugins required during the setup phase. Location: plugins/main/public/types.ts:43

WazuhStartPlugins

Plugins required during the start phase. Location: plugins/main/public/types.ts:51

AppDependencies

Context object passed to application components. Location: plugins/main/public/types.ts:37

Server Plugin

The server-side plugin provides REST API routes and background jobs.

WazuhPlugin (Server)

Location: plugins/main/server/plugin.ts:177

setup() (Server)

Signature:
Server setup tasks:
  1. Registers route handler context - Adds wazuh context to request handlers
  2. Adds security headers - Configures X-Frame-Options
  3. Creates router - Sets up HTTP route handling
  4. Registers health checks - Initializes index pattern and API checks
  5. Configures notifications - Sets up notification channels if available
Example:

start() (Server)

Signature:
Server start tasks:
  1. Initializes background jobs - Starts API initialization checks
  2. Starts queue processing - Begins queue job runner
  3. Loads global configuration - Retrieves server settings

Server Routes

The main plugin exposes several REST API route groups.

Wazuh API Routes

Location: plugins/main/server/routes/wazuh-api.ts

POST /api/check-stored-api

Validates a stored API configuration.
string
required
API host ID to check
string
Previous ID if changed
Response:

POST /api/check-api

Validates API credentials without storing them.
string
required
Wazuh API URL
number
required
API port number
string
required
API username
string
required
API password

POST /api/login

Authenticates with a configured API host.
string
required
API host ID
boolean
default:false
Force token refresh
Response:

POST /api/request

Proxies a request to the Wazuh API.
string
required
API host ID
string
required
HTTP method (GET, POST, PUT, DELETE)
string
required
API endpoint path
object
Request payload
Example:

POST /api/csv

Exports API response data as CSV.
string
required
API host ID
string
required
API endpoint path
object
Query filters

GET /api/routes

Returns available Wazuh API routes for the Dev Tools console. Response:

Host Management Routes

Location: plugins/main/server/routes/wazuh-hosts.ts

GET /hosts/apis

Retrieve all configured API hosts.

POST /hosts/apis

Add a new API host configuration.

PUT /hosts/apis/:id

Update an existing API host.

DELETE /hosts/apis/:id

Remove an API host configuration.

Elasticsearch Routes

Location: plugins/main/server/routes/wazuh-elastic.ts

GET /elastic/known-fields/:pattern

Get known fields for an index pattern.

GET /elastic/visualizations

Retrieve visualization saved objects.

POST /elastic/index-patterns

Create or update index patterns.

Utility Routes

Location: plugins/main/server/routes/wazuh-utils/ui-logs.ts

POST /utils/logs/ui

Log client-side errors to the server.
string
required
Log level (info, error, warning)
string
required
Log message
string
Source location in UI

Global Services

The plugin exposes global services through the kibana-services module. Location: plugins/main/public/kibana-services.ts

Wazuh Core API

Shared services and configuration

Components

Reusable UI components

API Console

Interactive API testing

Server Architecture

Server-side architecture guide