Logstash Output Plugin for Azure Data Explorer (Kusto)
This is a plugin for Logstash.
It is fully free and open source. The license is Apache 2.0.
This Azure Data Explorer (ADX) Logstash plugin enables you to process events from Logstash into an Azure Data Explorer database for later analysis.
This connector forwards data to Azure Data Explorer, Azure Synapse Data Explorer and Real time analytics in Fabric
Requirements
- Logstash version 8.7+. Installation instructions
- Azure Data Explorer cluster with a database. Read Create a cluster and database for more information.
- AAD Application credentials with permission to ingest data into Azure Data Explorer. Read Creating an AAD Application for more information.
Installation
To make the Azure Data Explorer plugin available in your Logstash environment, run the following command:
bin/logstash-plugin install logstash-output-kustoConfiguration
Perform configuration before sending events from Logstash to Azure Data Explorer. The following example shows the minimum you need to provide. It should be enough for most use-cases:
output {
kusto {
path => "/tmp/kusto/%{+YYYY-MM-dd-HH-mm}.txt"
ingest_url => "https://ingest-<cluster-name>.kusto.windows.net/"
app_id => "<application id>"
app_key => "<application key/secret>"
app_tenant => "<tenant id>"
database => "<database name>"
table => "<target table>"
json_mapping => "<mapping name>"
proxy_host => "<proxy host>"
proxy_port => <proxy port>
proxy_protocol => <"http"|"https">
}
}More information about configuring Logstash can be found in the logstash configuration guide
Streaming ingestion
Queued ingestion remains the default and is recommended for high-throughput workloads. For lower ingestion latency, enable streaming mode:
output {
kusto {
ingestion_mode => "streaming"
streaming_max_request_bytes => 1048576
streaming_temp_directory => "/var/lib/logstash/kusto-streaming"
ingest_url => "https://ingest-<cluster-name>.kusto.windows.net/"
app_id => "<application id>"
app_key => "<application key/secret>"
app_tenant => "<tenant id>"
database => "<database name>"
table => "<target table>"
json_mapping => "<mapping name>"
}
}Streaming ingestion must be enabled on the target Kusto table. The connector groups encoded events into requests of at most 1 MiB by default, measured in bytes. It never splits one event: an event above the configured target is sent intact, and the Kusto client decides whether to stream it or fall back to queued ingestion.
Before acknowledging a Logstash batch, the connector writes all requests into an atomic local spool batch. Accepted requests are removed, transient failures apply backpressure and retry with interruptible exponential delays, and final non-success statuses are quarantined for investigation without replaying the entire request.
Streaming delivery is at least once. A process or host failure after Kusto accepts a request but before the local spool file is removed can cause that request to be recovered and ingested again. The stable source identifier is used for request tracking; it does not provide Kusto-side row deduplication.
The SDK's Queued result means the request was transferred to queued ingestion, not that ingestion into the table has completed. Continue monitoring Kusto ingestion failures for later mapping, schema, encoding-policy, or row-size failures.
The default spool is a destination-specific directory under Logstash path.data. Streaming mode defaults to private 0700 directories and 0600 files, rejects symlinked or untrusted recovery files, and allows only one active plugin instance per spool. When setting a custom directory, place it on persistent local storage with trusted parent directories. Group- or world-writable dir_mode and file_mode values are rejected.
Available Configuration Keys
| Parameter Name | Description | Notes |
|---|---|---|
| path | The plugin writes events to temporary files before sending them to ADX. This parameter includes a path where files should be written and a time expression for file rotation to trigger an upload to the ADX service. The example above shows how to rotate the files every minute and check the Logstash docs for more information on time expressions. | Required for queued ingestion |
| ingest_url | The Kusto endpoint for ingestion-related communication. See it on the Azure Portal. | Required |
| app_id, app_key, app_tenant | Credentials required to connect to the ADX service. Be sure to use an application with 'ingest' privileges. | Optional |
| managed_identity | Managed Identity to authenticate. For user-based managed ID, use the Client ID GUID. For system-based, use the value system. The ID needs to have 'ingest' privileges on the cluster. |
Optional |
| database | Database name to place events | Required |
| table | Target table name to place events | Required |
| json_mapping | Maps each attribute from incoming event JSON strings to the appropriate column in the table. Note that this must be in JSON format, as this is the interface between Logstash and Kusto | Optional |
| recovery | If set to true (default), plugin will attempt to resend pre-existing temp files upon startup. With streaming, disabling recovery can leave committed spool files unprocessed after restart. | |
| delete_temp_files | Determines if temp files will be deleted after a successful upload (true is default; set false for debug purposes only) | |
| flush_interval | The time (in seconds) for flushing writes to temporary files. Default is 2 seconds, 0 will flush on every event. Increase this value to reduce IO calls but keep in mind that events in the buffer will be lost in case of abrupt failure. | |
| dir_mode | Directory permissions. Streaming defaults to 0700 and rejects group- or world-writable values. |
|
| file_mode | Temporary-file permissions. Streaming defaults to 0600 and rejects group- or world-writable values. |
|
| proxy_host | The proxy hostname for redirecting traffic to Kusto. | |
| proxy_port | The proxy port for the proxy. Defaults to 80. | |
| proxy_protocol | The proxy server protocol , is one of http or https. | |
| ingestion_mode |
queued for throughput-oriented ingestion or streaming for low-latency ingestion with automatic queued fallback. |
Defaults to queued
|
| streaming_max_request_bytes | Target maximum encoded bytes per streaming request. A single event is never split. | Defaults to 1048576 |
| streaming_max_retry_attempts | Transient retries before an interruptible cooldown cycle. During an outage, workers remain bounded and backpressure the Logstash pipeline instead of creating an unbounded retry queue. | Defaults to 2 |
| streaming_retry_backoff_seconds | Initial delay for connector retries; later retries use exponential backoff. | Defaults to 1 |
| streaming_concurrent_requests | Maximum streaming upload worker count. | Defaults to 4 |
| streaming_temp_directory | Durable local spool for streaming requests and restart recovery. Only one active output may use a directory. | Defaults below Logstash path.data/plugins/logstash-output-kusto
|
Note : LS_JAVA_OPTS can be used to set proxy parameters as well (using export or SET options)
export LS_JAVA_OPTS="-Dhttp.proxyHost=1.2.34 -Dhttp.proxyPort=8989 -Dhttps.proxyHost=1.2.3.4 -Dhttps.proxyPort=8989"Release Notes and versions
| Version | Release Date | Notes |
|---|---|---|
| 2.2.0 | 2026-07-16 | - Add opt-in Kusto streaming ingestion with byte-bounded requests, automatic queued fallback, durable restart recovery, bounded backpressure, secure local spooling, streaming metrics, and production stress coverage. Queued ingestion remains the default. |
| 2.0.8 | 2024-10-23 | - Fix library deprecations, fix issues in the Azure Identity library |
| 2.0.7 | 2024-01-01 | - Update Kusto JAVA SDK |
| 2.0.3 | 2023-12-12 | - Make JSON mapping field optional. If not provided logstash output JSON attribute names will be used for column resolution |
| 2.0.2 | 2023-11-28 | - Bugfix for the scenario where the plugin uses managed identity. Instead of providing the managed identity name as empty in the config,it can completely be skipped |
| 2.0.0 | 2023-09-19 | - Upgrade to the latest Java SDK version 5.0.2. Tests have been performed on Logstash 8.5 and up (Does not work with 6.x or 7.x versions of Logstash - For these versions use 1.x.x versions of logstash-output-kusto gem) - Fixes CVE's in common-text & outdated Jackson libraries |
| 1.0.6 | 2022-11-29 | - Upgrade to the latest Java SDK 3.2.1 version. Tests have been performed on Logstash 6.x and up. |
Development Requirements
- Openjdk 8 64bit (https://www.openlogic.com/openjdk-downloads)
- JRuby 9.2 or higher, defined with openjdk 8 64bit
- Logstash, defined with openjdk 8 64bit
It is reccomened to use the bundled jdk and jruby with logstash to avoid compatibility issues.
To fully build the gem, run:
bundle install
lock_jars
gem buildContributing
All contributions are welcome: ideas, patches, documentation, bug reports, and complaints. Programming is not a required skill. It is more important to the community that you are able to contribute. For more information about contributing, see the CONTRIBUTING file.