$logclihelpusage:logcli [<flags>] <command> [<args> ...]Acommand-lineforloki.Flags:--helpShowcontext-sensitivehelp (also try--help-longand--help-man).--versionShowapplicationversion.-q,--quietSuppressquerymetadata.--statsShowquerystatistics.-o,--output=defaultSpecifyoutputmode [default, raw,jsonl].rawsuppressesloglabelsandtimestamp.-z,--timezone=LocalSpecifythetimezonetousewhenformattingoutputtimestamps [Local, UTC]. --cpuprofile=""SpecifythelocationforwritingaCPUprofile. --memprofile=""Specifythelocationforwritingamemoryprofile. --addr="http://localhost:3100"Serveraddress.CanalsobesetusingLOKI_ADDRenvvar. --username=""UsernameforHTTPbasicauth.CanalsobesetusingLOKI_USERNAMEenvvar. --password=""PasswordforHTTPbasicauth.CanalsobesetusingLOKI_PASSWORDenvvar. --ca-cert=""PathtotheserverCertificateAuthority.CanalsobesetusingLOKI_CA_CERT_PATHenvvar.--tls-skip-verifyServercertificateTLSskipverify. --cert=""Pathtotheclientcertificate.CanalsobesetusingLOKI_CLIENT_CERT_PATHenvvar. --key=""Pathtotheclientcertificatekey.CanalsobesetusingLOKI_CLIENT_KEY_PATHenvvar. --org-id="" adds X-Scope-OrgID to API requests for representing tenant ID. Useful for requesting tenant data when
bypassinganauthgateway.Commands:help [<command>...]Showhelp.query [<flags>] <query>RunaLogQLquery.The"query"commandisusefulforqueryingforlogs.Logscanbereturnedinafewoutputmodes:raw:loglinedefault:logtimestamp+loglabels+loglinejsonl:JSONresponsefromLokiAPIofloglineTheoutputofthelogcanbespecifiedwiththe"-o"flag,forexample,"-o raw"fortherawoutputformat. The "query" command will output extra information about the query and its results, such as the API URL, set of common labels,
andsetofexcludedlabels.Thisextrainformationcanbesuppressedwiththe--quietflag. While "query" does support metrics queries, its output contains multiple data points between the start and end query time.
This output is used to build graphs, like what is seen in the Grafana Explore graph view. If you are querying metrics and just
want the most recent data point (like what is seen in the Grafana Explore table view), then you should use the "instant-query"
commandinstead.instant-query [<flags>] <query>RunaninstantLogQLquery. The "instant-query" command is useful for evaluating a metric query for a single point in time. This is equivalent to the
Grafana Explore table view; if you want a metrics query that is used to build a Grafana graph, you should use the "query"
commandinstead. This command does not produce useful output when querying for log lines; you should always use the "query" command when you
arerunninglogqueries.Formoreinformationaboutlogqueriesandmetricqueries,refertotheLogQLdocumentation:https://grafana.com/docs/loki/latest/logql/labels [<flags>] [<label>]Findvaluesforagivenlabel.series [<flags>] <matcher>Runseriesquery.$logclihelpqueryusage:logcliquery [<flags>] <query>RunaLogQLquery.The"query"commandisusefulforqueryingforlogs.Logscanbereturnedinafewoutputmodes:raw:loglinedefault:logtimestamp+loglabels+loglinejsonl:JSONresponsefromLokiAPIofloglineTheoutputofthelogcanbespecifiedwiththe"-o"flag,forexample,"-o raw"fortherawoutputformat.The "query" command will output extra information about the query and its results, such as the API URL, set of common labels, and
setofexcludedlabels.Thisextrainformationcanbesuppressedwiththe--quietflag.While "query" does support metrics queries, its output contains multiple data points between the start and end query time. This
output is used to build graphs, like what is seen in the Grafana Explore graph view. If you are querying metrics and just want the
most recent data point (like what is seen in the Grafana Explore table view), then you should use the "instant-query" command
instead.Flags:--helpShowcontext-sensitivehelp (also try--help-longand--help-man).--versionShowapplicationversion.-q,--quietSuppressquerymetadata.--statsShowquerystatistics.-o,--output=defaultSpecifyoutputmode [default, raw,jsonl].rawsuppressesloglabelsandtimestamp.-z,--timezone=LocalSpecifythetimezonetousewhenformattingoutputtimestamps [Local, UTC]. --cpuprofile=""SpecifythelocationforwritingaCPUprofile. --memprofile=""Specifythelocationforwritingamemoryprofile. --addr="http://localhost:3100"Serveraddress.CanalsobesetusingLOKI_ADDRenvvar. --username=""UsernameforHTTPbasicauth.CanalsobesetusingLOKI_USERNAMEenvvar. --password=""PasswordforHTTPbasicauth.CanalsobesetusingLOKI_PASSWORDenvvar. --ca-cert=""PathtotheserverCertificateAuthority.CanalsobesetusingLOKI_CA_CERT_PATHenvvar.--tls-skip-verifyServercertificateTLSskipverify. --cert=""Pathtotheclientcertificate.CanalsobesetusingLOKI_CLIENT_CERT_PATHenvvar. --key=""Pathtotheclientcertificatekey.CanalsobesetusingLOKI_CLIENT_KEY_PATHenvvar. --org-id="" adds X-Scope-OrgID to API requests for representing tenant ID. Useful for requesting tenant data when
bypassinganauthgateway. --limit=30Limitonnumberofentriestoprint. --since=1hLookbackwindow. --from=FROMStartlookingforlogsatthisabsolutetime (inclusive). --to=TOStoplookingforlogsatthisabsolutetime (exclusive). --step=STEP Query resolution step width, for metric queries. Evaluate the query at the specified step over the time
range. --interval=INTERVAL Query interval, for log queries. Return entries at the specified interval, ignoring those between.
**Thisparameterisexperimental,pleaseseeIssue1779**. --batch=1000Querybatchsizetouseuntil'limit'isreached.--forwardScanforwardsthroughlogs.--no-labelsDonotprintanylabels. --exclude-label=EXCLUDE-LABEL...Excludelabelsgiventheprovidedkeyduringoutput. --include-label=INCLUDE-LABEL...Includelabelsgiventheprovidedkeyduringoutput. --labels-length=0Setafixedpaddingtolabels. --store-config=""ExecutethecurrentqueryusingaconfiguredstoragefromagivenLokiconfigurationfile.-t,--tailTailthelogs. --delay-for=0Delayintailingbynumberofsecondstoaccumulatelogsforre-ordering.--colored-outputShowouputwithcoloredlabels.Args:<query> eg'{foo="bar",baz=~".*blip"} |~ ".*error.*"'$logclihelplabelsusage:logclilabels [<flags>] [<label>]Findvaluesforagivenlabel.Flags:--helpShowcontext-sensitivehelp (also try--help-longand--help-man).--versionShowapplicationversion.-q,--quietSuppressquerymetadata.--statsShowquerystatistics.-o,--output=defaultSpecifyoutputmode [default, raw,jsonl].rawsuppressesloglabelsandtimestamp.-z,--timezone=LocalSpecifythetimezonetousewhenformattingoutputtimestamps [Local, UTC]. --cpuprofile=""SpecifythelocationforwritingaCPUprofile. --memprofile=""Specifythelocationforwritingamemoryprofile. --addr="http://localhost:3100"Serveraddress.CanalsobesetusingLOKI_ADDRenvvar. --username=""UsernameforHTTPbasicauth.CanalsobesetusingLOKI_USERNAMEenvvar. --password=""PasswordforHTTPbasicauth.CanalsobesetusingLOKI_PASSWORDenvvar. --ca-cert=""PathtotheserverCertificateAuthority.CanalsobesetusingLOKI_CA_CERT_PATHenvvar.--tls-skip-verifyServercertificateTLSskipverify. --cert=""Pathtotheclientcertificate.CanalsobesetusingLOKI_CLIENT_CERT_PATHenvvar. --key=""Pathtotheclientcertificatekey.CanalsobesetusingLOKI_CLIENT_KEY_PATHenvvar. --org-id="" adds X-Scope-OrgID to API requests for representing tenant ID. Useful for requesting tenant data when
bypassinganauthgateway. --since=1hLookbackwindow. --from=FROMStartlookingforlabelsatthisabsolutetime (inclusive). --to=TOStoplookingforlabelsatthisabsolutetime (exclusive).Args: [<label>] Thenameofthelabel.$logclihelpseriesusage:logcliseries--match=MATCH [<flags>]Runseriesquery.Flags:--helpShowcontext-sensitivehelp (also try--help-longand--help-man).--versionShowapplicationversion.-q,--quietSuppressquerymetadata.--statsShowquerystatistics.-o,--output=defaultSpecifyoutputmode [default, raw,jsonl].rawsuppressesloglabelsandtimestamp.-z,--timezone=LocalSpecifythetimezonetousewhenformattingoutputtimestamps [Local, UTC]. --cpuprofile=""SpecifythelocationforwritingaCPUprofile. --memprofile=""Specifythelocationforwritingamemoryprofile. --addr="http://localhost:3100"Serveraddress.CanalsobesetusingLOKI_ADDRenvvar. --username=""UsernameforHTTPbasicauth.CanalsobesetusingLOKI_USERNAMEenvvar. --password=""PasswordforHTTPbasicauth.CanalsobesetusingLOKI_PASSWORDenvvar. --ca-cert=""PathtotheserverCertificateAuthority.CanalsobesetusingLOKI_CA_CERT_PATHenvvar.--tls-skip-verifyServercertificateTLSskipverify. --cert=""Pathtotheclientcertificate.CanalsobesetusingLOKI_CLIENT_CERT_PATHenvvar. --key=""Pathtotheclientcertificatekey.CanalsobesetusingLOKI_CLIENT_KEY_PATHenvvar. --org-id="" adds X-Scope-OrgID to API requests for representing tenant ID. Useful for requesting tenant data when
bypassinganauthgateway. --since=1hLookbackwindow. --from=FROMStartlookingforlogsatthisabsolutetime (inclusive). --to=TOStoplookingforlogsatthisabsolutetime (exclusive). --match=MATCH...eg'{foo="bar",baz=~".*blip"}'