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.
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.
Elasticsearch Quick Start Guide can be found here.
Elasticsearch Configuration#
The default Elasticsearch configuration is located at:
deployments/foundational/elk/configs/elasticsearch.yml
Setting |
Default Value |
Description |
|---|---|---|
|
|
Network interface to bind to for incoming connections. |
|
|
HTTP port for REST API access. |
|
|
Security features are disabled by default for development. |
|
|
Directory for storing index data. |
|
|
Directory for Elasticsearch log files. |
Elasticsearch Indices#
Elasticsearch indices created for the Blueprint applications include:
Elasticsearch indices# Index Pattern
Description
mdx-raw-*Index pattern for
mdx-rawdata, with daily data in separate indices named asmdx-raw-YYYY-MM-dd.
mdx-bev-*Daily index pattern for
mdx-bevdata,mdx-bev-YYYY-MM-dd.
mdx-behavior-*Similar daily index pattern for
mdx-behaviordata,mdx-behavior-YYYY-MM-dd.
mdx-cluster-labelsStores cluster IDs, model versions, and cluster names.
mdx-alerts-*Daily indexing pattern for
mdx-alertsdata.
mdx-vlm-alerts-*Daily indexing pattern for VLM-generated alert data.
mdx-events-*Daily indices for various event data including IN/OUT tripwire events, ENTRY/EXIT ROI events, etc.
mdx-occupancy-resetStores occupancy reset data for various locations.
mdx-frames-*Daily indexing pattern for
mdx-framesdata.
mdx-mtmc-*Daily indices for
mdx-mtmcdata.
mdx-rtls-*Daily indexing pattern for
mdx-rtlsdata.
mdx-space-utilization-*Daily indices for space utilization analytics data.
mdx-amr-locations-*Daily indices for
mdx-amr-locationsdata.
mdx-amr-events-*Daily indices for AMR events data.
mdx-incidents-*Daily indices for detected incident data.
mdx-vlm-incidents-*Daily indices for VLM-detected incidents.
mdx-embed-*Daily indices for vision embeddings data with dense vector support.
mdx-calibrationStores current calibration states.
mdx-calibration-auditLogs each calibration update.
mdx-calibration-imagesStores metadata of calibration images.
mdx-configsHolds current configurations of various microservices.
mdx-configs-auditLogs each update made to the microservices’ configurations.
mdx-usd-assetsStores USD (Universal Scene Description) assets configuration.
mdx-road-networkStores road network configuration data.
mdx-sensor-lookupStores sensor lookup information for coordinate mapping.
Note
You can use the Elasticsearch Python library to query the indices. You can find more details regarding the library and sample code here.
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 tuningIndex-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:
deployments/foundational/elk/init-scripts/elasticsearch-template-creation.sh
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:
deployments/foundational/elk/init-scripts/elasticsearch-ingest-pipeline-creation.sh
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.
Additional information regarding ILM can be found here.
ILM Configuration
The ILM poll interval is configured to 30 seconds (default is 10 minutes) for faster policy execution:
{
"persistent": {
"indices.lifecycle.poll_interval": "30s"
}
}
ILM Policies
The following ILM policies are created during initialization:
ILM Policy Reference# Policy Name
Current Retention Period
Index Pattern
mdx-raw-ilm-policy4 hours
mdx-raw-*indices
mdx-bev-ilm-policy4 hours
mdx-bev-*indices
mdx-behavior-ilm-policy4 hours
mdx-behavior-*indices
mdx-alerts-ilm-policy4 hours
mdx-alerts-*indices
mdx-vlm-alerts-ilm-policy4 hours
mdx-vlm-alerts-*indices
mdx-events-ilm-policy4 hours
mdx-events-*indices
mdx-frames-ilm-policy4 hours
mdx-frames-*indices
mdx-mtmc-ilm-policy4 hours
mdx-mtmc-*indices
mdx-rtls-ilm-policy4 hours
mdx-rtls-*indices
mdx-space-utilization-ilm-policy4 hours
mdx-space-utilization-*indices
mdx-amr-locations-ilm-policy4 hours
mdx-amr-locations-*indices
mdx-amr-events-ilm-policy4 hours
mdx-amr-events-*indices
mdx-incidents-ilm-policy4 hours
mdx-incidents-*indices
mdx-vlm-incidents-ilm-policy4 hours
mdx-vlm-incidents-*indices
mdx-embed-ilm-policy8 hours
mdx-embed-*indices (longer retention for embeddings)
Note
ILM is used to manage index retention and delete old indices.
By default, indices are deleted every 4 hours to manage disk space on development systems. The
mdx-embedindex has 8-hour retention due to the value of embedding data.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:
deployments/foundational/elk/init-scripts/elasticsearch-ilm-policy-creation.sh
Modifying Retention Periods
To change the retention period for an index, update the ILM policy in the initialization script:
# Example: Change mdx-behavior retention to 24 hours
create_ilm_policy 'mdx-behavior-ilm-policy' \
'{"policy":{"phases":{"delete":{"min_age":"24h","actions":{"delete":{}}}}}}'
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.
Additional information regarding Logstash can be found here.
Logstash Configuration#
The default Logstash configuration is located at:
deployments/foundational/elk/configs/logstash.yml
Setting |
Default Value |
Description |
|---|---|---|
|
|
Number of workers for pipeline processing. |
|
|
Ensures events are processed in order. |
|
|
Disables Elastic Common Schema compatibility for legacy format. |
|
|
Elasticsearch hosts for monitoring data. |
|
|
HTTP API binding address. |
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
Input Source Comparison# Feature
Kafka
Redis Streams
Throughput
Optimized for high throughput with batching
Optimized for low latency with smaller batches
Memory Footprint
Higher memory requirements for broker and consumers
Lightweight, suitable for resource-constrained environments
Message Retention
Configurable retention with replay support
Memory-based with optional persistence (AOF/RDB)
Consumer Groups
Native support with offset tracking
Native support via XREADGROUP
Setup Complexity
Single node or cluster (KRaft mode)
Single instance or Redis Cluster
Recommended For
Datacenter and cloud deployments
Edge deployments with limited resources
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.
For complete configuration, refer to:
deployments/foundational/elk/configs/mdx-kafka-logstash.conf
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 acknowledgmentsBinary 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:
deployments/foundational/elk/configs/mdx-redis-logstash.conf
Configuration Options:
Option
Type
Default
Description
hoststring
"localhost"Redis server hostname
portnumber
6379Redis server port
stream_keystring
"mystream"Redis stream key to read from
groupstring
"logstash_group"Consumer group name
batch_sizenumber
100Maximum entries to read per batch
data_fieldstring
"value"Field name containing the message data
data_codechash
{}Data decoding configuration:
Default
{}uses plain text (UTF-8)For protobuf: set
type => "protobuf"withclass_nameand optionallyclass_file
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.
Additional information regarding Kibana can be found here.
Kibana Configuration#
The default Kibana configuration for the deployment is located at:
deployments/foundational/elk/configs/kibana.yml
Setting |
Default Value |
Description |
|---|---|---|
|
|
Network interface for Kibana server. |
|
|
Graceful shutdown timeout period. |
|
|
Elasticsearch cluster endpoints. |
|
|
Enables container-aware monitoring UI. |