Add datasourceUid info

This commit is contained in:
Ivana 2020-07-13 12:50:30 +02:00
parent 73468e1481
commit 84dce1dcfd
1 changed files with 22 additions and 20 deletions

View File

@ -40,8 +40,8 @@ Just add it as a data source and you are ready to query your log data in [Explor
The Derived Fields configuration allows you to: The Derived Fields configuration allows you to:
* Add fields parsed from the log message. - Add fields parsed from the log message.
* Add a link that uses the value of the field. - Add a link that uses the value of the field.
You can use this functionality to link to your tracing backend directly from your logs, or link to a user profile page if a userId is present in the log line. These links appear in the [log details](/features/explore/#labels-and-parsed-fields). You can use this functionality to link to your tracing backend directly from your logs, or link to a user profile page if a userId is present in the log line. These links appear in the [log details](/features/explore/#labels-and-parsed-fields).
{{< docs-imagebox img="/img/docs/v65/loki_derived_fields.png" class="docs-image--no-shadow" caption="Screenshot of the derived fields configuration" >}} {{< docs-imagebox img="/img/docs/v65/loki_derived_fields.png" class="docs-image--no-shadow" caption="Screenshot of the derived fields configuration" >}}
@ -86,15 +86,15 @@ For the label part of the query expression, wrap it in curly braces `{}` and the
The following label matching operators are currently supported: The following label matching operators are currently supported:
* `=` exactly equal. - `=` exactly equal.
* `!=` not equal. - `!=` not equal.
* `=~` regex-match. - `=~` regex-match.
* `!~` do not regex-match. - `!~` do not regex-match.
Examples: Examples:
* `{name=~"mysql.+"}` - `{name=~"mysql.+"}`
* `{name!~"mysql.+"}` - `{name!~"mysql.+"}`
The [same rules that apply for Prometheus Label Selectors](https://prometheus.io/docs/prometheus/latest/querying/basics/#instant-vector-selectors) apply for Loki Log Stream Selectors. The [same rules that apply for Prometheus Label Selectors](https://prometheus.io/docs/prometheus/latest/querying/basics/#instant-vector-selectors) apply for Loki Log Stream Selectors.
@ -106,9 +106,9 @@ After writing the Log Stream Selector, you can filter the results further by wri
Example queries: Example queries:
* `{job="mysql"} |= "error"` - `{job="mysql"} |= "error"`
* `{name="kafka"} |~ "tsdb-ops.*io:2003"` - `{name="kafka"} |~ "tsdb-ops.*io:2003"`
* `{instance=~"kafka-[23]",name="kafka"} != "kafka.server:type=ReplicaManager"` - `{instance=~"kafka-[23]",name="kafka"} != "kafka.server:type=ReplicaManager"`
Filter operators can be chained and will sequentially filter down the expression. The resulting log lines will satisfy every filter. Filter operators can be chained and will sequentially filter down the expression. The resulting log lines will satisfy every filter.
@ -118,10 +118,10 @@ Filter operators can be chained and will sequentially filter down the expression
The following filter types are currently supported: The following filter types are currently supported:
* `|=` line contains string. - `|=` line contains string.
* `!=` line doesn't contain string. - `!=` line doesn't contain string.
* `|~` line matches regular expression. - `|~` line matches regular expression.
* `!~` line does not match regular expression. - `!~` line does not match regular expression.
> Note: For more details about LogQL, Loki's query language, refer to the [documentation](https://github.com/grafana/loki/blob/master/docs/logql.md) > Note: For more details about LogQL, Loki's query language, refer to the [documentation](https://github.com/grafana/loki/blob/master/docs/logql.md)
@ -130,6 +130,7 @@ The following filter types are currently supported:
Loki supports Live tailing which displays logs in real-time. This feature is supported in [Explore]({{< relref "../explore/#loki-specific-features" >}}). Loki supports Live tailing which displays logs in real-time. This feature is supported in [Explore]({{< relref "../explore/#loki-specific-features" >}}).
Note that Live Tailing relies on two Websocket connections: one between the browser and the Grafana server, and another between the Grafana server and the Loki server. If you run any reverse proxies, please configure them accordingly. The following example for Apache2 can be used for proxying between the browser and the Grafana server: Note that Live Tailing relies on two Websocket connections: one between the browser and the Grafana server, and another between the Grafana server and the Loki server. If you run any reverse proxies, please configure them accordingly. The following example for Apache2 can be used for proxying between the browser and the Grafana server:
``` ```
ProxyPassMatch "^/(api/datasources/proxy/\d+/loki/api/v1/tail)" "ws://127.0.0.1:3000/$1" ProxyPassMatch "^/(api/datasources/proxy/\d+/loki/api/v1/tail)" "ws://127.0.0.1:3000/$1"
``` ```
@ -193,14 +194,15 @@ datasources:
derivedFields: derivedFields:
# Field with internal link pointing to data source in Grafana. # Field with internal link pointing to data source in Grafana.
# Right now, Grafana supports only Jaeger and Zipkin data sources as link targets. # Right now, Grafana supports only Jaeger and Zipkin data sources as link targets.
# datasourceUid value can be anything, but it should be unique across all defined datasource uids
- datasourceUid: my_jaeger_uid - datasourceUid: my_jaeger_uid
matcherRegex: "traceID=(\\w+)" matcherRegex: "traceID=(\\w+)"
name: TraceID name: TraceID
# url will be interpreted as query for the datasource # url will be interpreted as query for the datasource
url: "$${__value.raw}" url: '$${__value.raw}'
# Field with external link. # Field with external link.
- matcherRegex: "traceID=(\\w+)" - matcherRegex: "traceID=(\\w+)"
name: TraceID name: TraceID
url: "http://localhost:16686/trace/$${__value.raw}" url: 'http://localhost:16686/trace/$${__value.raw}'
``` ```