ELK
The ELK stack (Elasticsearch, Logstash, Kibana) provides the data pipeline and analytics infrastructure for all the blueprints. Video analytics data flows from microservices through Kafka or Redis Streams, gets processed by Logstash, indexed into Elasticsearch, and visualized in Kibana.
The Docker deployment uses Elasticsearch 9.4.4, Logstash 9.4.4, and Kibana 9.4.4.
Elasticsearch
Elasticsearch is a versatile datastore that provides real-time search and analytics capabilities for large volumes of textual, numerical, geospatial, structured, and unstructured data.
Elasticsearch provides a RESTful API and client libraries for on-demand querying and data manipulation.
Refer to the Elasticsearch Quick Start Guide.
Elasticsearch Configuration
The default Elasticsearch configuration is located at:
Elasticsearch with GPU
Elasticsearch 9.4.4 also supports GPU-based dense vector embedding. To enable it, do the following.
Prerequisites
- Valid Elasticsearch license (required for GPU-based dense vector indexing). Purchase from Elastic subscriptions.
- NVIDIA GPU with supported driver and Docker NVIDIA Container Toolkit (
nvidia-container-toolkit) installed.
Elasticsearch license and GPU verification
After Elasticsearch is running, you can use the following. Replace <ip> with your Elasticsearch host (e.g. localhost or the node IP). Port is 9200 if unchanged.
- Check current license:
- Apply or update the Elasticsearch license (supply your license JSON as the request body; use
--data @path/to/license.jsonto send a file):
- Check whether GPU is in use (inspect node settings):
1. Elasticsearch Dockerfiles
The infra service provides the default Elasticsearch Dockerfile and a sample GPU Dockerfile under deploy/docker/services/infra/Dockerfiles/:
elasticsearch.Dockerfile: Default CPU Elasticsearch image.elasticsearch-gpu.Dockerfile: Sample GPU-enabled Elasticsearch Dockerfile for dense vector indexing.
The sample GPU Dockerfile uses a multi-stage build with Elasticsearch and CUDA base images, adds cuvs (GPU-accelerated vector search), and lets Docker Compose build the Elasticsearch container with GPU indexing support.
2. Infra compose (deploy/docker/services/infra/compose.yml)
In deploy/docker/services/infra/compose.yml, find services.elasticsearch.build.dockerfile in the main elasticsearch service and update only that field. Use Dockerfiles/elasticsearch${ELASTICSEARCH_MODE:+-${ELASTICSEARCH_MODE}}.Dockerfile so the value resolves to Dockerfiles/elasticsearch.Dockerfile by default and Dockerfiles/elasticsearch-gpu.Dockerfile when ELASTICSEARCH_MODE=gpu.
3. Environment
In your deployment environment (e.g., .env or export before running compose):
- Set
ELASTICSEARCH_MODE=gputo build and run the GPU image. - Optionally set
ELASTICSEARCH_GPU_DEVICE_IDwhen Elasticsearch should use a GPU other than0. For example, setELASTICSEARCH_GPU_DEVICE_ID=1to reserve GPU1.
Add the following GPU reservation block under the main elasticsearch service in deploy/docker/services/infra/compose.yml:
After updating the Dockerfile and compose, rebuild and start the stack so the Elasticsearch container uses the GPU image and has access to the specified GPU. To verify GPU usage,
when dense vectors are being indexed, use nvtop or nvidia-smi.
Elasticsearch Indices
Elasticsearch indices created for the Blueprint applications include:
Caption and summary indices use a collection name rather than the Kafka topic name or a daily suffix:
- If the message includes
info.collection_name, Logstash uses that value as the index name. For example,collection_name: "warehouse-summary"writes towarehouse-summary. - Otherwise, Logstash prefixes the stream ID with
default_, replacing hyphens, slashes, backslashes, and spaces with underscores. For example,streamId: "camera-01"writes todefault_camera_01.
You can use the Elasticsearch Python library to query the indices. Refer to the Elasticsearch Python client for the library reference and sample code.
Index Templates
Index templates automatically apply settings and mappings when new indices are created, ensuring consistency across all video analytics data. Templates are applied based on index name patterns with priority ordering — higher priority templates override lower ones for the same index.
When to review templates:
- Base template (
metropolis_template): Adjustnumber_of_shards,refresh_interval, ortranslog.durabilityfor scaling and performance tuning - Index-specific templates: Enable or disable field indexing based on your query patterns and storage requirements
For the complete list of templates and their exact mappings, refer to the initialization script:
Ingest Pipelines
Ingest pipelines preprocess documents before indexing. The following pipeline is created during initialization:
insertion-timestamp-pipeline
A pipeline that automatically adds insertion timestamps to documents. Microservices can specify a target field name, and the pipeline populates it with the current UTC timestamp.
The pipeline configuration is located in:
Index Lifecycle Management (ILM)
Index Lifecycle Management (ILM) is the recommended way to manage Elasticsearch indices in ELK 9.x. ILM allows you to automate index rollover, retention, and deletion based on policies.
Refer to Index lifecycle management for additional ILM information.
ILM Configuration
The ILM poll interval is configured to 30 seconds (default is 10 minutes) for faster policy execution:
ILM Policies
The following ILM policies are created during initialization:
- ILM is used to manage index retention and delete old indices.
- By default,
ELASTICSEARCH_ILM_MIN_AGEis set to4h, so ILM deletes indices after that duration to manage disk space on development systems. - If the system has sufficient storage capacity, then the data retention period can be increased.
- To modify the retention duration, edit the ILM policy configuration in:
Modifying Retention Periods
To change the retention period for an index, update the ILM policy in the initialization script:
Logstash
Logstash is a powerful data processing pipeline that helps collect data from source, transform, and ship data to sink. It provides a flexible configuration system for handling various input sources, data transformations, and output destinations.
Logstash reads data from Kafka or Redis Streams and indexes it into Elasticsearch.
The Docker deployment uses Logstash 9.4.4.
Refer to the Logstash introduction for additional information.
Logstash Configuration
The default Logstash configuration is located at:
Kafka vs Redis Streams
Logstash can consume data from either Kafka or Redis Streams. Two configurations are provided to support different deployment scenarios:
- Kafka: Datacenter deployments with higher throughput requirements and sufficient infrastructure
- Redis Streams: Edge deployments with minimal memory footprint and simpler operational overhead
Kafka Input Plugin
For Kafka-based deployments, Logstash uses the built-in Kafka input plugin with Protocol Buffer decoding.
For a complete list of Kafka topics, their data formats, and class names, see Kafka topics.
Configuration Options:
For complete configuration, refer to:
Redis Stream Input Plugin
For Redis Streams support, a custom Logstash input plugin (logstash-input-redis_stream) is provided that offers:
- Consumer Group Support - Uses
XREADGROUPfor reliable message delivery with acknowledgments - Binary Data Support - Reads raw binary data from Redis Streams
- Protobuf Decoding - Native support for decoding Protocol Buffer messages
- Automatic Reconnection - Handles connection failures with automatic retry
For a complete list of Redis streams, their data formats, and class names, see Redis streams.
For complete configuration, refer to:
Configuration Options:
Kibana
Kibana is a powerful visualization and analytics platform that works seamlessly with Elasticsearch. It provides an intuitive interface for exploring the data, visualizing the data using dashboards, and managing your Elasticsearch data.
The Docker deployment uses Kibana 9.4.4.
Refer to the Kibana documentation for additional information.
Kibana Configuration
The default Kibana configuration for the deployment is located at:
Kibana Dashboards
Kibana dashboards combine multiple visualizations (tables, histograms, charts) into a single view for exploring and analyzing Elasticsearch data. Some deployments (for example, the 2D and 3D Warehouse Vision AI Profiles) include visualizations, and dashboards.
For more on creating and using dashboards, see the Kibana documentation on dashboards. For building individual visualizations, see Create visualizations.
FAQ
ELK Services Timeouts or Startup Health Check Failures
The Docker health checks for ELK services are defined in the deployment compose file:
From the deployment repository root, this is deploy/docker/services/infra/compose.yml. If Kibana shows Request timeout: "Request timed out", inspect the relevant service logs before changing Kibana settings.
A common root cause is Elasticsearch disk pressure. In Kibana Discover, this can appear as Unable to retrieve search results with Request timeout: "Request timed out". Check Elasticsearch allocation and disk watermarks before tuning Kibana timeouts. See the Elasticsearch disk watermark FAQ below.
If Docker marks Elasticsearch, Kibana, or Logstash as unhealthy during startup, check the container logs to confirm the service is starting slowly rather than failing because of a configuration issue. On slower hosts, increase the affected service’s healthcheck.retries value in this compose file, for example from 60 to 90 or 120, and redeploy. This only gives the ELK service more time to pass its startup health check; it does not fix ingestion or indexing issues.
Elasticsearch Disk Watermarks and Read-Only Indices
Elasticsearch uses disk-based shard allocation to keep data nodes from filling their disks. One common symptom is Kibana Discover failing with Unable to retrieve search results and Request timeout: "Request timed out". The default watermarks are:
Use these commands to inspect disk allocation and the active watermark settings. Replace <ip> with your Elasticsearch host, such as localhost or the node IP.
If flood stage is reached, fix the disk pressure first. Common options are:
- Remove unnecessary local data or logs from the Elasticsearch host.
- Remove unnecessary containers which are not being used.
- Add disk capacity or add Elasticsearch capacity so shards have somewhere safe to move.
After disk usage drops below the high watermark, Elasticsearch normally removes the read-only block automatically. If the block remains after disk pressure is fixed, clear it manually:
Avoid increasing or disabling disk watermarks as a long-term fix. Doing so can allow Elasticsearch to fill the disk completely, which may cause indexing failures, service instability, or data loss.