Logs

    Dapr produces structured logs to stdout either as a plain text or JSON formatted. By default, all Dapr processes (runtime and system services) write to console out in plain text. To enable JSON formatted logs, you need to add the command flag when running Dapr processes.

    If you want to use a search engine such as Elastic Search or Azure Monitor to search the logs, it is recommended to use JSON-formatted logs which the log collector and search engine can parse using the built-in JSON parser.

    Dapr produces logs based on the following schema.

    Plain text and JSON formatted logs

    • Plain text log examples
    • JSON formatted log examples

    To use JSON formatted logs, you need to add additional configuration when you install Dapr and deploy your app. The recommendation is to use JSONformatted logs because most log collectors and search engines can parse JSON more easily with built-in parsers.

    Configuring log format in Kubernetes

    The following steps describe how to configure JSON formatted logs for Kubernetes

    You can enable JSON formatted logs for Dapr system services by adding option to Helm command.

    Enable JSON formatted log for Dapr sidecars

    If you run Dapr in a Kubernetes cluster, is a popular container log collector. You can use Fluentd with a json parser plugin to parse Dapr JSON formatted logs. This shows how to configure the Fluentd in your cluster.

    If you are using the Azure Kubernetes Service, you can use the default OMS Agent to collect logs with Azure Monitor without needing to install Fluentd.

    Search engines

    If you use , we recommend to using Elastic Search and Kibana. This how-to shows how to set up Elastic Search and Kibana in your Kubernetes cluster.