Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/logcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"time"

"github.com/alecthomas/kingpin/v2"
dskit_log "github.com/grafana/dskit/log"
dskit_server "github.com/grafana/dskit/server"
"github.com/prometheus/common/config"
"github.com/prometheus/common/version"

Expand All @@ -26,6 +28,7 @@ import (
"github.com/grafana/loki/v3/pkg/logcli/volume"
"github.com/grafana/loki/v3/pkg/logql/syntax"
_ "github.com/grafana/loki/v3/pkg/util/build"
util_log "github.com/grafana/loki/v3/pkg/util/log"
)

var (
Expand All @@ -35,6 +38,7 @@ var (
Default("false").
Short('q').
Bool()
logLevel = app.Flag("log.level", "Log level").Default("error").Enum("error", "warning", "info", "debug")
statistics = app.Flag("stats", "Show query statistics").Default("false").Bool()
outputMode = app.Flag("output", "Specify output mode [default, raw, jsonl]. raw suppresses log labels and timestamp.").
Default("default").
Expand Down Expand Up @@ -357,6 +361,10 @@ func main() {

cmd := kingpin.MustParse(app.Parse(os.Args[1:]))

var dLevel dskit_log.Level
_ = dLevel.Set(*logLevel)
util_log.InitLogger(&dskit_server.Config{LogLevel: dLevel}, nil, true)

if cpuProfile != nil && *cpuProfile != "" {
cpuFile, err := os.Create(*cpuProfile)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions docs/sources/query/logcli/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ Flags:
--[no-]envproxy Use ProxyFromEnvironment to use net/http
ProxyFromEnvironment configuration, eg HTTP_PROXY
($LOKI_ENV_PROXY)
--log.level Only log messages with the given severity or above. Valid levels: [debug, info, warn, error]

Commands:
help [<command>...]
Expand Down