Configuring the Observability Realm
Manual configuration
Important
All configuration of spaces, keys and privileges described in the following stages must be carried out directly via the Elastic website or interface (Elasticsearch), as this procedure is native to that platform.
The configuration is based on three main elements:
Creating a Space in Elastic associated with the Realm.
The definition of a custom role with permissions restricted to the Realm.
The generation of an API Key linked to those permissions.
The full process is set out below:
1. Access to the Observability project on Elastic
Go to the Elasticsearch interface and select the Serverless Project for observability set up by your administrator or Elastic owner.
Attention
Please check that you are in the correct environment before creating spaces, roles or API keys. This check is important to ensure that credentials are not generated in a project other than the one you will be using with WOCU-Monitoring
2. Creation of the Space associated with the Realm
The first step is to create a Space in Elastic for the Observability Realm.
To do this:
Open the side menu Admin and settings > Spaces.
Create a new space using the + Create Space option.
![]()
Next, configure the following fields in the creation form:
![]()
Name: Enter a descriptive name for the Realm (e.g.
central_1). The name of the space must match the functional name of the Realm.Initials: enter a short term that will appear in the Space’s avatar box (e.g.
C1).Cross-project search: select the
This projectoption to limit searches to data from the current project only. This is the recommended option for keeping the focus on a single environment and optimising query performance.
If this space is not your current workspace, click Switch to this space. When you do so, your Kibana session will automatically be redirected to the new space (central_1).
3. Creating a custom role
To avoid using credentials with global permissions, a custom role associated with the Realm must be created. This role acts as a permissions reference and allows access to be restricted solely to the necessary resources, such as metric indices, events or logs from the Realm and its corresponding Space in Kibana.
To do this:
Open the side menu Admin and settings > Custom Roles.
Create a new role using the + Create role option.
![]()
The role’s identifying details must be configured at the top of the creation form:
![]()
Role name: the unique name of the role. This cannot be changed once it has been created. It is recommended that you use a consistent naming convention that includes the realm identifier (e.g.
central_1).Role description: a functional description of the role. This field helps to identify the purpose of the role within Elastic (e.g.
Kibana base user role for central_1).Data Layer: this section defines the access permissions for data stored in Elastic.
Index privileges: the indexes associated with the Realm must be specified. These indexes define the data that the role will be able to query. For a Realm with the identifier
central_1, the indexes to be configured would be:metrics-wocu-central_1 monitoring-events-central_1 syslogs-central_1 traps-central_1Privileges: the following permission must be assigned:
read. This permission allows the user to view metrics, events and logs for the Realm, without granting write or administrative access to the indices.Grant access to specific fields and Grant read privileges to specific documents must remain disabled, unless additional filtering by fields or documents is required.
Application Layer: this section defines which Space and features the role will have access to within Kibana.
Spaces: select only the Space associated with the Realm (e.g.
central_1). It is not recommended to assign the role to all Spaces, as this would compromise the isolation between Realms.Privileges: select the Custom option to assign only the necessary permissions. As a general rule, the role should grant read access to the features required to view the Realm’s observability data, whilst avoiding administrative permissions.
Once you have configured the fields above, click Create role to save the new role.
4. Creating the API key
The API Key enables WOCU-Monitoring and its components to connect securely to Elastic in order to read and write observability data from the Realm, such as metrics, events, syslogs or traps.
Using it avoids the need to rely on global credentials or personal user accounts, and allows access to be restricted solely to the indexes and resources associated with the Realm.
To do this:
Open the side menu Admin and settings > API KEYS.
Create a new API using the + Create API key option.
![]()
In the creation form, configure the fields:
![]()
Name: a descriptive name for the new API (e.g.
central_1). It is recommended that a consistent naming convention be used, including the Realm identifier.Control security privileges: this option is used to limit the scope of the key. When enabled, Elastic will display a JSON editor where you can define the specific privileges that the API key will have.
Copy the following JSON code into the editor to assign write permissions and define the indexes for your Realm.
Attention
You must replace [name of realm] with the actual identifier for your realm.
{ "role-read-write-[nombre del reino]": { "cluster": [ "monitor_inference" ], "indices": [ { "names": [ "monitoring-events-[nombre del reino]", "metrics-wocu-[nombre del reino]", "syslog-[nombre del reino]", "flexwan-[nombre del reino]", "traps-[nombre del reino]", "import_tool_cache_conf_hosts", "import_tool_cache_conf_hostgroups", "import_tool_cache_realms_info", ".ml-anomalies-wocu-ml-job-[nombre del reino]", "*[nombre del reino]*", "task_summaries", "livestatus_evolution" ], "privileges": [ "read", "write", "create_index", "view_index_metadata" ], "allow_restricted_indices": false } ], "applications": [ { "application": "kibana-.kibana", "privileges": [ "feature_agentBuilder.all", "feature_actions.read" ], "resources": [ "space:[nombre del reino]" ] } ], "run_as": [], "metadata": {}, "transient_metadata": { "enabled": true } } }
Once you have edited the JSON, click the Create API KEY button.
Permissions required by the AI Assistant (Elastic Agent Builder)
The IA Assistant uses the Elastic Agent Builder API, which requires an Enterprise licence and, at a minimum, Elastic Stack 9.3.
The realm’s API key must include the application privilege feature_agentBuilder.all on kibana-.kibana, as shown in the JSON above.
The ‘read’ level is sufficient for conversation, but internal consumption accounting uses an API that Kibana authorises with the ‘manageAgents’ privilege, which is included only in ‘feature_agentBuilder.all` (verified empirically: with read, it returns a 403 error indicating agentBuilder:manageAgents).
Furthermore, feature_agentBuilder.all also allows you to create, edit and delete agents and tools. That is why the example restricts the application privilege to the Realm Space using "resources": ["space:[kingdom name]"]; using ["*"] would extend it to all Kibana Spaces and is not recommended. If your version of Kibana exposes the manage_agents sub-privilege independently, you can replace feature_agentBuilder.all with ["feature_agentBuilder.read", "feature_agentBuilder.manage_agents"]; test this against your deployment before applying it in production.
Availability depends on the version of Elastic:
Stack 9.4 or later: Agent Builder is the default chat experience. No further action is required.
Stack 9.3: Agent Builder is available as a preview and must be enabled manually from the Kibana chat experience selector. If it is not enabled, calls to
/api/agent_builder/*are unavailable even if the API key has the correct permissions. In 9.3, the chat function works, but usage accounting (POST /api/agent_builder/agents/{agent_id}/consumption) is not available: WOCU-Monitoring skips hourly synchronisation, and the AI Assistant’s usage and cost reports are incomplete. Usage accounting requires Stack 9.4 or later (or Serverless).Serverless: this is enabled by default.
Stack 9.2 or earlier: not supported.
Without this privilege, all calls to /api/agent_builder/* return 403 Forbidden and the AI Assistant does not work, although the rest of the Realm’s observability features continue to operate normally.
In addition:
The example role does not grant generic cluster privileges (
"cluster": ["all"]would grant all cluster privileges and is not required for WOCU-Monitoring). It includes onlymonitor_inference, which is only required if the agent uses an AI connector that calls the Elasticsearch Inference API (for example, Elastic-managed connectors); if this is not the case, you can leave the cluster list empty.The agent’s tools require
readandview_index_metadatapermissions on the indexes they query. Both are included in the Realm’s index block.The
feature_actions.readprivilege is required to list the available inference connectors (/api/actions/connectors). Read-only access is sufficient: WOCU-Monitoring only queries the list; it does not create or modify connectors.The AI Assistant’s internal consumption accounting (a recurring task in WOCU-Monitoring) makes a call to
POST /api/agent_builder/agents/{agent_id}/consumption, available from Stack 9.4 (and in Serverless). Although this is a read operation, Kibana authorises it using theagentBuilder:manageAgentsprivilege, so the Realm API Key must havefeature_agentBuilder.all. In Stack 9.3 and in deployments where Agent Builder is not available, data collection is automatically skipped.In deployments created prior to the migration to Agent Builder, the role granted
feature_observabilityAIAssistant.alland privileges over the internal index.kibana-observability-ai-assistant-conversations*. Both are now obsolete: conversations are now managed via the Agent Builder API rather than through direct access to the index. When updating an existing API key, replace the old privilege withfeature_agentBuilder.all, remove the block on that index, and reducefeature_actions.alltofeature_actions.read.
5. Obtaining the token
The platform will generate the key in three output formats: Encoded, Beats and Logstash.
On this occasion, select and copy the token in Encoded format and save this value temporarily, as it will be used in the next section, specifically in the variable
ELASTICSEARCH_API_KEY.Alternatively, you can also select the Beats and Logstash formats, which are required for configuring Fluentd and TD-Agent.
6. Realm Variable Settings
Once you have retrieved the data from Elastic, open the Realm configuration file and enter the following mandatory environment variables:
Important
The variables must be validated using the configuration specified by the engineering team for each deployment.
Server and Ingest Variables (Section: Monitoring)
LOGGER_SERVER: The Elasticsearch public endpoint associated with the project.LOGGER SERVER="endpoint"The value of the variable is retrieved from the Elastic console by accessing the relevant Serverless Observability project.
La ruta de acceso es la siguiente: Serverless projects > [nombre_del_proyecto] > Overview
Next, locate the Application endpoints, cluster and component IDs section and select the Elasticsearch option.
![]()
METRIC_SERVER: Metrics server (same value as inLOGGER_SERVER).METRIC_SERVER="endpoint"
ELASTICSEARCH_API_KEY: Authentication key copied in Encoded format (Step 5: Obtaining the token). Connects the system for reading and writing metrics, events and notifications.ELASTICSEARCH_API_KEY="clave de autenticación"Other Mandatory Configuration Variables
ELASTICSEARCH_SERVERLESS_MODE: Mandatory mode for serverless environments (always enabled).ELASTICSEARCH_SERVERLESS_MODE="True"
GCONF_ENABLED: Enables the Gconf service (always active).GCONF_ENABLED="True"
GCONF_SERVICES_HOST: The URL for accessing the configuration server provided. It must be specified including the protocol, the IP address and the relevant port.GCONF_SERVICES_HOST="https://[IP]:[PORT]"
MYSQL_SERVER: IP address of the central database provided.MYSQL_SERVER="IP"
MYSQL_USER: Add the name of the realm as appropriate.MYSQL_USER="nombre_reino"
MYSQL_ROOT_PASSWORD: Contraseña de acceso a la base de datos (mismo nombre del reino).MYSQL_ROOT_PASSWORD="nombre_reino"
Note
Para infraestructuras distribuidas también se requiere la autenticación de ProxySQL.
7. Creating an Observability Realm in WOCU-Monitoring
Finally, the Observability Section is enabled via the Realm creation form itself, configured with the Elasticsearch backend.
To create a new standard monitoring realm, go to the Settings menu and click the + New Realm button, as shown in the image below:
This action will open the form for creating the Realm. You will then need to configure the fields described in the following sections:
Display Name: enter the name of the realm (e.g. central_1).
Import Tool: to add your first Import Tool, click the + button next to the field.
The fields that need to be amended to register a new Import Tool are:
Name: enter the name of the realm (e.g.
central_1).Import tool host: the IP address or hostname where the Import Tool is hosted (e.g.
10.57.20.73).Import Tool port: port for connecting to the Import Tool API (e.g.
50280).Import Tool API Protocol: the protocol used by WOCU-Monitoring to connect to the Import Tool API. Select the
httpoption from the drop-down menu.API Optimisation: tick the box to enable optimisation of queries made to the Import Tool API.
Next:
Confirm the changes you have made by clicking the Create button.
Select the new Import Tool from the drop-down menu to continue.
![]()
Monitoring Host: the IP address or hostname of the machine hosting the database (e.g. 10.57.20.73).
Monitoring port: the server’s network port. By default, 50000.
Backend technology: select the Elasticsearch option.
Elasticsearch backend: in this new selector, you can add a new backend by clicking the + button.
The fields that need to be amended are:
![]()
Backend name: the name used to identify the Elasticsearch backend. It must be a unique value that is easily recognisable to the user (e.g.
elasticsearch9-production).Elasticsearch URL: The URLs of the Elasticsearch 9 nodes to which WOCU-Monitoring will connect.
For deployments managed via the Elastic console, the value must be obtained by accessing the relevant Serverless Observability project.
The path is as follows:
Serverless projects > [nombre_del_proyecto] > Overview
Next, locate the Application endpoints, cluster and component IDs section, select the Elasticsearch option and copy the value shown under Public endpoint.
This endpoint is the value that must be entered in the Elasticsearch URL field.
![]()
API Key: this API Key is generated by the Elastic tool itself. Here you must enter the key generated in step 3. Obtaining the Token of this same process, corresponding to the Realm’s own API Key.
Next:
Confirm the changes you have made by clicking the Create button.
Select the new backend from the drop-down menu to continue.
![]()
Metric Index: enter the name of the Realm (e.g. central_1). The system will automatically add the appropriate prefix to the metric index.
Monitoring Events Index: enter the name of the Realm (e.g. central_1). The system will automatically add the corresponding prefix to the monitoring events index.
Observability: tick this box to enable the Observability Section in this new Realm.
Host Name: enter the name of the realm (e.g. central_1).
Once you have entered all the required details, save the form settings by clicking the Add Realm button.
8. Enabling observability in an existing environment
There may be cases where you wish to enable the Observability Section module in an existing realm.
To do this, click on the Configuration option, which can be accessed via the Settings selector. This will open a new browser window giving you access to the advanced WM Console Admin module, from where you can manage a range of advanced WOCU-Monitoring functions.
Next, select the Realm option from the left-hand side menu and navigate to the Realm you wish to edit. Once you are in the edit profile screen, tick the Observability box.
Finally, save your changes by clicking the Save button and return to the Realm to start using the module’s features.
Congratulations! The initial configuration of the Observability module has been completed successfully.
Configuration via a script
Script-based configuration enables the automated creation of the Observability Realm in the Elastic Cloud, reducing the need for manual intervention and facilitating consistent configuration across different environments.
The full process is set out below:
1. Requesting the master API key
Before running the script, ask the Cloud environment administrator or superadmin for the Elastic master API key.
This key is generated only once and, by default, must already exist in the environment. The master API key has sufficient permissions to create and configure the necessary resources in the Elastic Observability Realm.
Once you have obtained this key, you will have the necessary credentials to continue with the script-based configuration process.
Important
The master API key must only be used for provisioning or initial configuration tasks. It must not be used as an operational credential for the Realm, as it has global permissions within the environment.
2. Creating the Realm API Key
Once the master API key is available, a secondary API key associated with the Observability Realm must be created. This will be the operational key used by the Realm, with permissions restricted via a JSON privilege structure.
To create it, follow these steps:
Go to the Elasticsearch interface and select the Serverless Project for observability set up by your administrator or Elastic owner.
Attention
Please check that you are in the correct environment before creating spaces, roles or API keys. This check is important to ensure that credentials are not generated in a project other than the one you will be using with WOCU-Monitoring
Log in to Space by default.
Navigate to the Admin and settings side menu > API KEYS and create a new API key.
In the creation form, configure the fields:
Name: a descriptive name for the new API (e.g.
central_1). It is recommended that you use the same identifier as that of the Realm.Control security privileges: this option is used to limit the scope of the key. When enabled, Elastic will display a JSON editor where you can define the specific privileges that the API key will have.
Copy the following JSON code into the editor to assign write permissions and define the indexes for your Realm.
Attention
You must replace [name of realm] with the actual identifier for your realm.
{ "role-read-write-[nombre del reino]": { "cluster": [ "monitor_inference" ], "indices": [ { "names": [ "monitoring-events-[nombre del reino]", "metrics-wocu-[nombre del reino]", "syslog-[nombre del reino]", "flexwan-[nombre del reino]", "traps-[nombre del reino]", "import_tool_cache_conf_hosts", "import_tool_cache_conf_hostgroups", "import_tool_cache_realms_info", ".ml-anomalies-wocu-ml-job-[nombre del reino]", "*[nombre del reino]*", "task_summaries", "livestatus_evolution" ], "privileges": [ "read", "write", "create_index", "view_index_metadata" ], "allow_restricted_indices": false } ], "applications": [ { "application": "kibana-.kibana", "privileges": [ "feature_agentBuilder.all", "feature_actions.read" ], "resources": [ "space:[nombre del reino]" ] } ], "run_as": [], "metadata": {}, "transient_metadata": { "enabled": true } } }
Click Create API Key to generate the key.
Important
The IA Assistant uses the Elastic Agent Builder API, so the API key must include the feature_agentBuilder.all privilege. Without this privilege, calls to /api/agent_builder/* return a 403 Forbidden error. This functionality requires an Enterprise licence and, at a minimum, Elastic Stack 9.3.
In Stack 9.3, Agent Builder is in preview and must be enabled manually from Kibana; from 9.4 onwards, it is the default experience. Token usage tracking (usage and cost reports) requires Stack 9.4 or later; in 9.3, only the chat feature is available.
Please refer to the section Creating the API Key for full details of permissions, version requirements and instructions on updating keys created prior to migration to Agent Builder.
3. Obtaining the token
The platform will generate the key in three output formats:
Encoded
Beats
Logstash
Important
It is essential to save the API key in all three available formats. These values are only displayed when the API key is created. If they are not saved at that time, they cannot be retrieved later and you will need to generate a new API key.
4. Creating a Realm in WOCU-Monitoring and linking the API key
Finally, the Observability Section is enabled via the Realm creation form itself, configured with the Elasticsearch backend.
To create a new standard monitoring realm, go to the Settings menu and click the + New Realm button, as shown in the image below:
This action will open the form for creating the Realm. You will then need to configure the fields described in the following sections:
![]()
Display Name: enter the name of the realm (e.g.
central_1).Import Tool: to add your first Import Tool, click the + button next to the field.
![]()
The fields that need to be amended to register a new Import Tool are:
Name: enter the name of the realm (e.g.
central_1).Import tool host: the IP address or hostname where the Import Tool is hosted (e.g.
10.57.20.73).Import Tool port: port for connecting to the Import Tool API (e.g.
50280).Import Tool API Protocol: the protocol used by WOCU-Monitoring to connect to the Import Tool API. Select the
httpoption from the drop-down menu.API Optimisation: tick the box to enable optimisation of queries made to the Import Tool API.
Next:
Confirm the changes you have made by clicking the Create button.
Select the new Import Tool from the drop-down menu to continue.
![]()
Monitoring Host: the IP address or hostname of the machine hosting the database (e.g.
10.57.20.73).Monitoring port: the server’s network port. By default,
50000.Backend technology: select the
Elasticsearchoption.Elasticsearch backend: to add your first backend, click the + button next to the field.
The fields that need to be amended are:
![]()
Backend name: the name used to identify the Elasticsearch backend. It must be a unique value that is easily recognisable to the user (e.g.
elasticsearch9-production).Elasticsearch URL: The URLs of the Elasticsearch 9 nodes to which WOCU-Monitoring will connect.
For deployments managed via the Elastic console, the value must be obtained by accessing the relevant Serverless Observability project.
The path is as follows:
Serverless > [nombre_del_proyecto] > OverviewNext, locate the Application endpoints, cluster and component IDs section, select the Elasticsearch option and copy the value shown under Public endpoint.
This endpoint is the value that must be entered in the Elasticsearch URL field.
![]()
API Key: this API Key is generated by the Elastic tool itself. Here you must enter the key generated in step 3. Obtaining the Token of this same process, corresponding to the Realm’s own API Key.
Next:
Confirm the changes you have made by clicking the Create button.
Select the new backend from the drop-down menu to continue.
![]()
Metric Index: enter the name of the Realm (e.g.
central_1). The system will automatically add the appropriate prefix to the metric index.Monitoring Events Index: enter the name of the Realm (e.g.
central_1). The system will automatically add the corresponding prefix to the monitoring events index.Observability: tick this box to enable the Observability Section in this new Realm.
Host Name: enter the name of the realm (e.g.
central_1).
Once you have entered all the required details, save the form settings by clicking the Add Realm button.
5. Running the script from the aggregator console
The next step is to run the configuration script from the aggregator’s console.
This script must be available in the environment and will use the previously configured environment variables, including the one corresponding to the master API key. This API has extensive permissions within the Elastic environment and should therefore not be used as an operational credential for all Realms. Its use in this procedure is exceptional and limited to initial provisioning tasks, as it enables the automated creation and configuration of the necessary resources in the Elastic Cloud.
The aim of the script is to set up the Observability Realm in Elastic, avoiding the need for a complete manual configuration and facilitating faster, more consistent provisioning. Once the process is complete, each Realm must operate using its own specific API key, with permissions restricted to its indices, Space and associated resources.
Para ejecutar el script, utilice el siguiente comando desde la consola del agregador:
/opt/wocu/embedded/bin/python3 /opt/wocu/embedded/wocu/wocu-aggregator/wocu-aggregator/manage.py configure_kibana_realm_spaces <nombre_del_reino>
Where it says ‘<realm_name>’, this must be replaced with the actual identifier of the realm you wish to configure.
Example:
/opt/wocu/embedded/bin/python3 /opt/wocu/embedded/wocu/wocu-aggregator/wocu-aggregator/manage.py configure_kibana_realm_spaces central_1
Important
The master API key should only be used for this type of initial configuration task. It must not be reused as an operational key for the realms, as it has global permissions within the Elastic environment.
Congratulations! The initial configuration of the Observability module has been completed successfully.