Apache Druid
  • Technology
  • Use Cases
  • Powered By
  • Docs
  • Community
  • Apache
  • Download

โ€บMonitoring

Getting started

  • Introduction to Apache Druid
  • Quickstart (local)
  • Single server deployment
  • Clustered deployment

Tutorials

  • Load files natively
  • Load files using SQL ๐Ÿ†•
  • Load from Apache Kafka
  • Load from Apache Hadoop
  • Querying data
  • Roll-up
  • Theta sketches
  • Configuring data retention
  • Updating existing data
  • Compacting segments
  • Deleting data
  • Writing an ingestion spec
  • Transforming input data
  • Tutorial: Run with Docker
  • Kerberized HDFS deep storage
  • Convert ingestion spec to SQL
  • Jupyter Notebook tutorials

Design

  • Design
  • Segments
  • Processes and servers
  • Deep storage
  • Metadata storage
  • ZooKeeper

Ingestion

  • Ingestion
  • Data formats
  • Data model
  • Data rollup
  • Partitioning
  • Ingestion spec
  • Schema design tips
  • Stream ingestion

    • Apache Kafka ingestion
    • Apache Kafka supervisor
    • Apache Kafka operations
    • Amazon Kinesis

    Batch ingestion

    • Native batch
    • Native batch: input sources
    • Migrate from firehose
    • Hadoop-based

    SQL-based ingestion ๐Ÿ†•

    • Overview
    • Key concepts
    • API
    • Security
    • Examples
    • Reference
    • Known issues
  • Task reference
  • Troubleshooting FAQ

Data management

  • Overview
  • Data updates
  • Data deletion
  • Schema changes
  • Compaction
  • Automatic compaction

Querying

    Druid SQL

    • Overview and syntax
    • SQL data types
    • Operators
    • Scalar functions
    • Aggregation functions
    • Multi-value string functions
    • JSON functions
    • All functions
    • Druid SQL API
    • JDBC driver API
    • SQL query context
    • SQL metadata tables
    • SQL query translation
  • Native queries
  • Query execution
  • Troubleshooting
  • Concepts

    • Datasources
    • Joins
    • Lookups
    • Multi-value dimensions
    • Nested columns
    • Multitenancy
    • Query caching
    • Using query caching
    • Query context

    Native query types

    • Timeseries
    • TopN
    • GroupBy
    • Scan
    • Search
    • TimeBoundary
    • SegmentMetadata
    • DatasourceMetadata

    Native query components

    • Filters
    • Granularities
    • Dimensions
    • Aggregations
    • Post-aggregations
    • Expressions
    • Having filters (groupBy)
    • Sorting and limiting (groupBy)
    • Sorting (topN)
    • String comparators
    • Virtual columns
    • Spatial filters

Configuration

  • Configuration reference
  • Extensions
  • Logging

Operations

  • Web console
  • Java runtime
  • Security

    • Security overview
    • User authentication and authorization
    • LDAP auth
    • Password providers
    • Dynamic Config Providers
    • TLS support

    Performance tuning

    • Basic cluster tuning
    • Segment size optimization
    • Mixed workloads
    • HTTP compression
    • Automated metadata cleanup

    Monitoring

    • Request logging
    • Metrics
    • Alerts
  • API reference
  • High availability
  • Rolling updates
  • Using rules to drop and retain data
  • Working with different versions of Apache Hadoop
  • Misc

    • dump-segment tool
    • reset-cluster tool
    • insert-segment-to-db tool
    • pull-deps tool
    • Deep storage migration
    • Export Metadata Tool
    • Metadata Migration
    • Content for build.sbt

Development

  • Developing on Druid
  • Creating extensions
  • JavaScript functionality
  • Build from source
  • Versioning
  • Experimental features

Misc

  • Papers

Hidden

  • Apache Druid vs Elasticsearch
  • Apache Druid vs. Key/Value Stores (HBase/Cassandra/OpenTSDB)
  • Apache Druid vs Kudu
  • Apache Druid vs Redshift
  • Apache Druid vs Spark
  • Apache Druid vs SQL-on-Hadoop
  • Authentication and Authorization
  • Broker
  • Coordinator Process
  • Historical Process
  • Indexer Process
  • Indexing Service
  • MiddleManager Process
  • Overlord Process
  • Router Process
  • Peons
  • Approximate Histogram aggregators
  • Apache Avro
  • Microsoft Azure
  • Bloom Filter
  • DataSketches extension
  • DataSketches HLL Sketch module
  • DataSketches Quantiles Sketch module
  • DataSketches Theta Sketch module
  • DataSketches Tuple Sketch module
  • Basic Security
  • Kerberos
  • Cached Lookup Module
  • Apache Ranger Security
  • Google Cloud Storage
  • HDFS
  • Apache Kafka Lookups
  • Globally Cached Lookups
  • MySQL Metadata Store
  • ORC Extension
  • Druid pac4j based Security extension
  • Apache Parquet Extension
  • PostgreSQL Metadata Store
  • Protobuf
  • S3-compatible
  • Simple SSLContext Provider Module
  • Stats aggregator
  • Test Stats Aggregators
  • Druid AWS RDS Module
  • Kubernetes
  • Ambari Metrics Emitter
  • Apache Cassandra
  • Rackspace Cloud Files
  • DistinctCount Aggregator
  • Graphite Emitter
  • InfluxDB Line Protocol Parser
  • InfluxDB Emitter
  • Kafka Emitter
  • Materialized View
  • Moment Sketches for Approximate Quantiles module
  • Moving Average Query
  • OpenTSDB Emitter
  • Druid Redis Cache
  • Microsoft SQLServer
  • StatsD Emitter
  • T-Digest Quantiles Sketch module
  • Thrift
  • Timestamp Min/Max aggregators
  • GCE Extensions
  • Aliyun OSS
  • Prometheus Emitter
  • kubernetes
  • Cardinality/HyperUnique aggregators
  • Select
  • Firehose (deprecated)
  • Native batch (simple)
  • Realtime Process
Edit

Request logging

All Apache Druid services that can serve queries can also log the query requests they process. Request logs contain information on query metrics, including execution time and memory usage. You can use information in the request logs to monitor query performance, determine bottlenecks, and analyze and improve slow queries.

Request logging is disabled by default. This topic describes how to configure Druid to generate request logs to track query metrics.

Configure request logging

To enable request logging, determine the type of request logger to use, then set the configurations specific to the request logger type.

The following request logger types are available:

  • noop: Disables request logging, the default behavior.
  • file: Stores logs to disk.
  • emitter: Logs request to an external location, which is configured through an emitter.
  • slf4j: Logs queries via the SLF4J Java logging API.
  • filtered: Filters requests by query type or execution time before logging the filtered queries by the delegated request logger.
  • composing: Logs all requests to multiple request loggers.
  • switching: Logs native queries and SQL queries to separate request loggers.

Define the type of request logger in druid.request.logging.type. See the Request logging configuration for properties to set for each type of request logger. Specify these properties in the common.runtime.properties file. You must restart Druid for the changes to take effect.

Druid stores the results in the Broker logs, unless the request logging type is emitter. If you use emitter request logging, you must also configure metrics emission.

Configure metrics emission

Druid includes various emitters to send metrics and alerts. To emit query metrics, set druid.request.logging.feed=emitter, and define the emitter type in the druid.emitter property.

You can use any of the following emitters in Druid:

  • noop: Disables metric emission, the default behavior.
  • logging: Emits metrics to Log4j 2. See Logging to configure Log4j 2 for use with Druid.
  • http: Sends HTTP POST requests containing the metrics in JSON format to a user-defined endpoint.
  • parametrized: Operates like the http emitter but fine-tunes the recipient URL based on the event feed.
  • composing: Emits metrics to multiple emitter types.
  • graphite: Emits metrics to a Graphite Carbon service.

Specify these properties in the common.runtime.properties file. See the Metrics emitters configuration for properties to set for each type of metrics emitter. You must restart Druid for the changes to take effect.

Example

The following configuration shows how to enable request logging and post query metrics to the endpoint http://example.com:8080/path.

# Enable request logging and configure the emitter request logger
druid.request.logging.type=emitter
druid.request.logging.feed=myRequestLogFeed

# Enable metrics emission and tell Druid where to emit messages
druid.emitter=http
druid.emitter.http.recipientBaseUrl=http://example.com:8080/path

# Authenticate to the base URL, if needed
druid.emitter.http.basicAuthentication=username:password

The following shows an example log emitter output:

[
    {
        "feed": "metrics",
        "timestamp": "2022-01-06T20:32:06.628Z",
        "service": "druid/broker",
        "host": "localhost:8082",
        "version": "2022.01.0-iap-SNAPSHOT",
        "metric": "sqlQuery/bytes",
        "value": 9351,
        "dataSource": "[wikipedia]",
        "id": "56e8317b-31cc-443d-b109-47f51b21d4c3",
        "nativeQueryIds": "[2b9cbced-11fc-4d78-a58c-c42863dff3c8]",
        "remoteAddress": "127.0.0.1",
        "success": "true"
    },
    {
        "feed": "myRequestLogFeed",
        "timestamp": "2022-01-06T20:32:06.585Z",
        "remoteAddr": "127.0.0.1",
        "service": "druid/broker",
        "sqlQueryContext":
        {
            "useApproximateCountDistinct": false,
            "sqlQueryId": "56e8317b-31cc-443d-b109-47f51b21d4c3",
            "useApproximateTopN": false,
            "useCache": false,
            "sqlOuterLimit": 101,
            "populateCache": false,
            "nativeQueryIds": "[2b9cbced-11fc-4d78-a58c-c42863dff3c8]"
        },
        "queryStats":
        {
            "sqlQuery/time": 43,
            "sqlQuery/planningTimeMs": 5,
            "sqlQuery/bytes": 9351,
            "success": true,
            "context":
            {
                "useApproximateCountDistinct": false,
                "sqlQueryId": "56e8317b-31cc-443d-b109-47f51b21d4c3",
                "useApproximateTopN": false,
                "useCache": false,
                "sqlOuterLimit": 101,
                "populateCache": false,
                "nativeQueryIds": "[2b9cbced-11fc-4d78-a58c-c42863dff3c8]"
            },
            "identity": "allowAll"
        },
        "query": null,
        "host": "localhost:8082",
        "sql": "SELECT * FROM wikipedia WHERE cityName = 'Buenos Aires'"
    },
    {
        "feed": "myRequestLogFeed",
        "timestamp": "2022-01-06T20:32:07.652Z",
        "remoteAddr": "",
        "service": "druid/broker",
        "sqlQueryContext":
        {},
        "queryStats":
        {
            "query/time": 16,
            "query/bytes": -1,
            "success": true,
            "identity": "allowAll"
        },
        "query":
        {
            "queryType": "scan",
            "dataSource":
            {
                "type": "table",
                "name": "wikipedia"
            },
            "intervals":
            {
                "type": "intervals",
                "intervals":
                [
                    "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
                ]
            },
            "virtualColumns":
            [
                {
                    "type": "expression",
                    "name": "v0",
                    "expression": "'Buenos Aires'",
                    "outputType": "STRING"
                }
            ],
            "resultFormat": "compactedList",
            "batchSize": 20480,
            "limit": 101,
            "filter":
            {
                "type": "selector",
                "dimension": "cityName",
                "value": "Buenos Aires",
                "extractionFn": null
            },
            "columns":
            [
                "__time",
                "added",
                "channel",
                "comment",
                "commentLength",
                "countryIsoCode",
                "countryName",
                "deleted",
                "delta",
                "deltaBucket",
                "diffUrl",
                "flags",
                "isAnonymous",
                "isMinor",
                "isNew",
                "isRobot",
                "isUnpatrolled",
                "metroCode",
                "namespace",
                "page",
                "regionIsoCode",
                "regionName",
                "user",
                "v0"
            ],
            "legacy": false,
            "context":
            {
                "populateCache": false,
                "queryId": "62e3d373-6e50-41b4-873b-1e56347c2950",
                "sqlOuterLimit": 101,
                "sqlQueryId": "cbb3d519-aee9-4566-8920-dbbeab6269f5",
                "useApproximateCountDistinct": false,
                "useApproximateTopN": false,
                "useCache": false
            },
            "descending": false,
            "granularity":
            {
                "type": "all"
            }
        },
        "host": "localhost:8082",
        "sql": null
    },
    ...
]

Learn more

See the following topics for more information.

  • Query metrics
  • Request logging configuration
  • Metrics emitters configuration
โ† Automated metadata cleanupMetrics โ†’
  • Configure request logging
  • Configure metrics emission
  • Example
  • Learn more

Technologyโ€‚ยทโ€‚Use Casesโ€‚ยทโ€‚Powered by Druidโ€‚ยทโ€‚Docsโ€‚ยทโ€‚Communityโ€‚ยทโ€‚Downloadโ€‚ยทโ€‚FAQ

โ€‚ยทโ€‚โ€‚ยทโ€‚โ€‚ยทโ€‚
Copyright ยฉ 2022 Apache Software Foundation.
Except where otherwise noted, licensed under CC BY-SA 4.0.
Apache Druid, Druid, and the Druid logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.