mirror of https://github.com/dapr/docs.git
Docs for logging options in the Configuration spec (#3034)
See dapr/dapr#5462 Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com> Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
parent
11f90b03bd
commit
b445c0314b
|
@ -48,6 +48,7 @@ The following configuration settings can be applied to Dapr application sidecars
|
|||
|
||||
- [Tracing](#tracing)
|
||||
- [Metrics](#metrics)
|
||||
- [Logging](#logging)
|
||||
- [Middleware](#middleware)
|
||||
- [Scope secret store access](#scope-secret-store-access)
|
||||
- [Access Control allow lists for building block APIs](#access-control-allow-lists-for-building-block-apis)
|
||||
|
@ -85,7 +86,7 @@ The following table lists the properties for tracing:
|
|||
`samplingRate` is used to enable or disable the tracing. To disable the sampling rate ,
|
||||
set `samplingRate : "0"` in the configuration. The valid range of samplingRate is between 0 and 1 inclusive. The sampling rate determines whether a trace span should be sampled or not based on value. `samplingRate : "1"` samples all traces. By default, the sampling rate is (0.0001) or 1 in 10,000 traces.
|
||||
|
||||
See [Observability distributed tracing]({{< ref "tracing-overview.md" >}}) for more information
|
||||
See [Observability distributed tracing]({{< ref "tracing-overview.md" >}}) for more information.
|
||||
|
||||
#### Metrics
|
||||
|
||||
|
@ -104,7 +105,29 @@ The following table lists the properties for metrics:
|
|||
|--------------|--------|-------------|
|
||||
| `enabled` | boolean | Whether metrics should to be enabled.
|
||||
|
||||
See [metrics documentation]({{< ref "metrics-overview.md" >}}) for more information
|
||||
See [metrics documentation]({{< ref "metrics-overview.md" >}}) for more information.
|
||||
|
||||
#### Logging
|
||||
|
||||
The logging section can be used to configure how logging works in the Dapr Runtime.
|
||||
|
||||
The `logging` section under the `Configuration` spec contains the following properties:
|
||||
|
||||
```yml
|
||||
logging:
|
||||
apiLogging:
|
||||
enabled: false
|
||||
omitHealthChecks: false
|
||||
```
|
||||
|
||||
The following table lists the properties for logging:
|
||||
|
||||
| Property | Type | Description |
|
||||
|--------------|--------|-------------|
|
||||
| `apiLogging.enabled` | boolean | The default value for the `--enable-api-logging` flag for `daprd` (and the corresponding `dapr.io/enable-api-logging` annotation): the value set in the Configuration spec is used as default unless a `true` or `false` value is passed to each Dapr Runtime. Default: `false`.
|
||||
| `apiLogging.omitHealthChecks` | boolean | If `true`, calls to health check endpoints (e.g. `/v1.0/healthz`) are not logged when API logging is enabled. This is useful if those calls are adding a lot of noise in your logs. Default: `false`
|
||||
|
||||
See [logging documentation]({{< ref "logs.md" >}}) for more information.
|
||||
|
||||
#### Middleware
|
||||
|
||||
|
@ -130,8 +153,8 @@ The following table lists the properties for HTTP handlers:
|
|||
|
||||
| Property | Type | Description |
|
||||
|----------|--------|-------------|
|
||||
| name | string | Name of the middleware component
|
||||
| type | string | Type of middleware component
|
||||
| `name` | string | Name of the middleware component
|
||||
| `type` | string | Type of middleware component
|
||||
|
||||
See [Middleware pipelines]({{< ref "middleware.md" >}}) for more information
|
||||
|
||||
|
|
|
@ -109,7 +109,9 @@ spec:
|
|||
|
||||
## API Logging
|
||||
|
||||
API logging enables you to see the API calls your application makes to the Dapr sidecar, to debug issues or monitor the behavior of your application. You can combine both Dapr API logging with Dapr log events. See [configure and view Dapr Logs]({{< ref "logs-troubleshooting.md" >}}) and [configure and view Dapr API Logs]({{< ref "api-logs-troubleshooting.md" >}}) for more information.
|
||||
API logging enables you to see the API calls your application makes to the Dapr sidecar, to debug issues or monitor the behavior of your application. You can combine both Dapr API logging with Dapr log events.
|
||||
|
||||
See [configure and view Dapr Logs]({{< ref "logs-troubleshooting.md" >}}) and [configure and view Dapr API Logs]({{< ref "api-logs-troubleshooting.md" >}}) for more information.
|
||||
|
||||
## Log collectors
|
||||
|
||||
|
|
|
@ -77,3 +77,37 @@ time="2022-03-16T18:32:02.917629403Z" level=info msg="HTTP API Called" method="P
|
|||
time="2022-03-16T18:32:03.137830112Z" level=info msg="HTTP API Called" method="POST /v1.0/invoke/{id}/method/{method:*}" app_id=invoke-caller instance=invokecaller-f4f949886-cbnmt scope=dapr.runtime.http-info type=log useragent=Go-http-client/1.1 ver=edge
|
||||
time="2022-03-16T18:32:03.359097916Z" level=info msg="HTTP API Called" method="POST /v1.0/invoke/{id}/method/{method:*}" app_id=invoke-caller instance=invokecaller-f4f949886-cbnmt scope=dapr.runtime.http-info type=log useragent=Go-http-client/1.1 ver=edge
|
||||
```
|
||||
|
||||
## API logging configuration
|
||||
|
||||
Using the [Dapr Configuration spec]({{< ref "configuration-overview.md" >}}#sidecar-configuration), you can configure the default behavior of API logging in Dapr runtimes.
|
||||
|
||||
### Enable API logging by default
|
||||
|
||||
Using the Dapr Configuration spec, you can set the default value for the `--enable-api-logging` flag (and the correspondent annotation when running on Kubernetes), with the `logging.apiLogging.enabled` option. This value applies to all Dapr runtimes that reference the Configuration document or resource in which it's defined.
|
||||
|
||||
- If `logging.apiLogging.enabled` is set to `false`, the default value, API logging is disabled for Dapr runtimes unless `--enable-api-logging` is set to `true` (or the `dapr.io/enable-api-logging: true` annotation is added).
|
||||
- When `logging.apiLogging.enabled` is `true`, Dapr runtimes have API logging enabled by default, and it can be disabled by setting
|
||||
`--enable-api-logging=false` or with the `dapr.io/enable-api-logging: false` annotation.
|
||||
|
||||
For example:
|
||||
|
||||
```yaml
|
||||
logging:
|
||||
apiLogging:
|
||||
enabled: true
|
||||
```
|
||||
|
||||
### Omit health checks from API logging
|
||||
|
||||
When API logging is enabled, all calls to the Dapr API server are logged, including those to health check endpoints (e.g. `/v1.0/healthz`). Depending on your environment, this may generate multiple log lines per minute and could create unwanted noise.
|
||||
|
||||
You can configure Dapr to not log calls to health check endpoints when API logging is enabled using the Dapr Configuration spec, by setting `logging.apiLogging.omitHealthChecks: true`. The default value is `false`, which means that health checks calls are logged in the API logs.
|
||||
|
||||
For example:
|
||||
|
||||
```yaml
|
||||
logging:
|
||||
apiLogging:
|
||||
omitHealthChecks: true
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue