Skip to content
Snippets Groups Projects
Commit 7081c4ed authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

Merge branch 'update_logging_docs' into 'master'

Update logging docs, add logcli example

See merge request openappstack/openappstack!354
parents a824cf19 1e1ecc62
No related branches found
No related tags found
No related merge requests found
...@@ -5,30 +5,38 @@ ...@@ -5,30 +5,38 @@
Logs from pods and containers can be read in different ways: Logs from pods and containers can be read in different ways:
* In the cluster filesystem at `/var/log/pods/` or `/var/logs/containers/`. * In the cluster filesystem at `/var/log/pods/` or `/var/logs/containers/`.
* Using [kubectl logs](https://kubectl.docs.kubernetes.io/pages/container_debugging/container_logs.html). * Using [kubectl logs](https://kubernetes.io/docs/concepts/cluster-administration/logging)
* Querying aggregated logs with grafana, see below. * Querying aggregated logs with Grafana, see below.
## Central log aggregation ## Central log aggregation
We use [promtail](https://github.com/grafana/loki/tree/master/docs/clients/promtail), We use [Promtail](https://grafana.com/docs/loki/latest/clients/promtail/),
[Loki](https://grafana.com/oss/loki/) and [grafana](https://grafana.com/) for [Loki](https://grafana.com/oss/loki/) and [Grafana](https://grafana.com/) for
easy access of aggregated logs. easy access of aggregated logs.
The [Loki documentation](https://github.com/grafana/loki#documentation) is a The [Loki documentation](https://grafana.com/docs/loki/latest/) is a
good starting point how this setup works, and the [Using Loki in Grafana](https://grafana.com/docs/grafana/latest/features/datasources/loki/) good starting point how this setup works, and the [Using Loki in Grafana](https://grafana.com/docs/grafana/latest/datasources/loki)
gets you started with querying your cluster logs with grafana. gets you started with querying your cluster logs with Grafana.
You will find the loki grafana integration on your cluster at https://grafana.oas.example.org/explore You will find the Loki Grafana integration on your cluster at https://grafana.oas.example.org/explore
together with some generic query examples. together with some generic query examples.
### LogQL query examples ### LogQL query examples
Please also refer to the [LogQL documentation](https://github.com/grafana/loki/blob/master/docs/logql%2Emd). Please also refer to the [LogQL documentation](https://grafana.com/docs/loki/latest/logql).
Query all aggregated logs (unfortunatly we can't find a better way of doing this
since LogQL always expects a stream label to get queried):
Query all apps for errors etc: logcli query '{foo!="bar"}'
Query all logs for a keyword:
logcli query '{foo!="bar"} |= "error"'
Query all k8s apps for errors using a regular expression:
logcli query '{job=~".*"} |~ "error|fail|exception|fatal"'
{job=~".*"} |~ "error|fail|exception|fatal"
{job=~".*"} |= "level=error"
#### Flux #### Flux
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment