You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* clarify logcli commands and output
This commit attempts to do two things:
1. Differentiate between log entries and raw log lines, where the latter
is what is produced by `-oraw`.
2. Explain the difference between `logcli query` and
`logcli instant-query`.
Fixesgrafana#1676.
* address feedback
* address more feedback
* explain that instant-query is not useful for log lines
* address review feedback
This commit leaves logcli.md unmodified; that will be done in a later
commit if the changes are approved.
* sync logcli.md with command output
outputMode=app.Flag("output", "specify output mode [default, raw, jsonl]. raw suppresses log labels and timestamp.").Default("default").Short('o').Enum("default", "raw", "jsonl")
26
26
timezone=app.Flag("timezone", "Specify the timezone to use when formatting output timestamps [Local, UTC]").Default("Local").Short('z').Enum("Local", "UTC")
27
27
28
28
queryClient=newQueryClient(app)
29
29
30
-
queryCmd=app.Command("query", "Run a LogQL query.")
30
+
queryCmd=app.Command("query", `Run a LogQL query.
31
+
32
+
The "query" command is useful for querying for logs. Logs can be
33
+
returned in a few output modes:
34
+
35
+
raw: log line
36
+
default: log timestamp + log labels + log line
37
+
jsonl: JSON response from Loki API of log line
38
+
39
+
The output of the log can be specified with the "-o" flag, for
40
+
example, "-o raw" for the raw output format.
41
+
42
+
The "query" command will output extra information about the query
43
+
and its results, such as the API URL, set of common labels, and set
44
+
of excluded labels. This extra information can be suppressed with the
45
+
--quiet flag.
46
+
47
+
While "query" does support metrics queries, its output contains multiple
48
+
data points between the start and end query time. This output is used to
49
+
build graphs, like what is seen in the Grafana Explore graph view. If
50
+
you are querying metrics and just want the most recent data point
51
+
(like what is seen in the Grafana Explore table view), then you should use
52
+
the "instant-query" command instead.`)
31
53
rangeQuery=newQuery(false, queryCmd)
32
54
tail=queryCmd.Flag("tail", "Tail the logs").Short('t').Default("false").Bool()
33
55
delayFor=queryCmd.Flag("delay-for", "Delay in tailing by number of seconds to accumulate logs for re-ordering").Default("0").Int()
34
56
35
-
instantQueryCmd=app.Command("instant-query", "Run an instant LogQL query")
36
-
instantQuery=newQuery(true, instantQueryCmd)
57
+
instantQueryCmd=app.Command("instant-query", `Run an instant LogQL query.
58
+
59
+
The "instant-query" command is useful for evaluating a metric query for
60
+
a single point in time. This is equivalent to the Grafana Explore table
61
+
view; if you want a metrics query that is used to build a Grafana graph,
62
+
you should use the "query" command instead.
63
+
64
+
This command does not produce useful output when querying for log lines;
65
+
you should always use the "query" command when you are running log queries.
66
+
67
+
For more information about log queries and metric queries, refer to the
app.Flag("cert", "Path to the client certificate. Can also be set using LOKI_CLIENT_CERT_PATH env var.").Default("").Envar("LOKI_CLIENT_CERT_PATH").StringVar(&client.TLSConfig.CertFile)
120
155
app.Flag("key", "Path to the client certificate key. Can also be set using LOKI_CLIENT_KEY_PATH env var.").Default("").Envar("LOKI_CLIENT_KEY_PATH").StringVar(&client.TLSConfig.KeyFile)
121
-
app.Flag("org-id", "org ID header to be substituted for auth").StringVar(&client.OrgID)
156
+
app.Flag("org-id", "adds X-Scope-OrgID to API requests for representing tenant ID. Useful for requesting tenant data when bypassing an auth gateway.").StringVar(&client.OrgID)
0 commit comments