Skip to content

Commit 5a041a9

Browse files
committed
OSDOCS-9119: Query Loki manually troubleshooting
1 parent 0d2defd commit 5a041a9

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * networking/network_observability/troubleshooting-network-observability.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="troubleshooting-query-loki-manually_{context}"]
7+
= Running custom queries to Loki
8+
9+
For troubleshooting, can run custom queries to Loki. There are two examples of ways to do this, which you can adapt according to your needs by replacing the <api_token> with your own.
10+
11+
[NOTE]
12+
====
13+
These examples use the `netobserv` namespace for the Network Observability Operator and Loki deployments. Additionally, the examples assume that the LokiStack is named `loki`. You can optionally use a different namespace and naming by adapting the examples, specifically the `-n netobserv` or the `loki-gateway` URL.
14+
====
15+
16+
.Prerequisites
17+
* Installed Loki Operator for use with Network Observability Operator
18+
19+
.Procedure
20+
21+
* To get all available labels, run the following:
22+
+
23+
[source,terminal]
24+
----
25+
$ oc exec deployment/netobserv-plugin -n netobserv -- curl -G -s -H 'X-Scope-OrgID:network' -H 'Authorization: Bearer <api_token>' -k https://loki-gateway-http.netobserv.svc:8080/api/logs/v1/network/loki/api/v1/labels | jq
26+
----
27+
28+
* To get all flows from the source namespace, `my-namespace`, run the following:
29+
+
30+
[source,terminal]
31+
----
32+
$ oc exec deployment/netobserv-plugin -n netobserv -- curl -G -s -H 'X-Scope-OrgID:network' -H 'Authorization: Bearer <api_token>' -k https://loki-gateway-http.netobserv.svc:8080/api/logs/v1/network/loki/api/v1/query --data-urlencode 'query={SrcK8S_Namespace="my-namespace"}' | jq
33+
----

observability/network_observability/troubleshooting-network-observability.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ include::modules/troubleshooting-network-observability-network-flow.adoc[levelof
1818

1919
include::modules/troubleshooting-network-observability-controller-manager-pod-out-of-memory.adoc[leveloffset=+1]
2020

21+
include::modules/troubleshooting-network-observability-query-loki-manually.adoc[leveloffset=+1]
22+
2123
[role="_additional-resources"]
2224
.Additional resources
2325
* xref:../../observability/network_observability/configuring-operator.adoc#network-observability-resources-table_network_observability[Resource considerations]

0 commit comments

Comments
 (0)