mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
// Module is included in the following assemblies:
|
|
//cluster-logging-loki.adoc
|
|
:_mod-docs-content-type: REFERENCE
|
|
[id="logging-logcli-about_{context}"]
|
|
|
|
= Querying Loki
|
|
|
|
You can use Loki's command-line interface `logcli` to query logs.
|
|
|
|
.Example Application Log Query
|
|
[source,terminal]
|
|
----
|
|
$ oc extract cm/lokistack-sample-ca-bundle --to=lokistack --confirm
|
|
----
|
|
|
|
[source,terminal]
|
|
----
|
|
$ cat lokistack/*.crt >lokistack_ca.crt
|
|
----
|
|
|
|
[source,terminal]
|
|
----
|
|
$ logcli -o raw --bearer-token="${bearer_token}" --ca-cert="lokistack_ca.crt" --addr xxxxxx
|
|
----
|
|
|
|
.Example Infrastructure Log Query
|
|
[source,terminal]
|
|
----
|
|
$ logcli --bearer-token="$(oc whoami -t)" --addr https://lokistack-dev-openshift-logging.apps.devcluster.openshift.com/api/logs/v1/infrastructure labels
|
|
----
|
|
|
|
.Example Audit log Query
|
|
[source,terminal]
|
|
----
|
|
$ logcli --bearer-token="$(oc whoami -t)" --addr https://lokistack-dev-openshift-logging.apps.devcluster.openshift.com/api/logs/v1/audit labels
|
|
----
|
|
|
|
.Additional resources
|
|
* link:https://grafana.com/docs/loki/latest/tools/logcli/[LogCLI Documentation]
|