{"record":{"id":"e72b56390812f2a6","repo":"grafana/k6","slug":"loki-configuration-should-be-in-the-form-loki-url","errorCode":null,"errorMessage":"loki configuration should be in the form `loki=url-to-push` but is `%s`","messagePattern":"loki configuration should be in the form `loki=url-to-push` but is `(.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/log/loki.go","lineNumber":132,"sourceCode":"\t\th.droppedLabels[params[0]] = params[1]\n\t}\n\n\th.droppedMsg = h.filterLabels(h.droppedLabels, h.droppedMsg)\n\th.client = &http.Client{Timeout: h.pushPeriod}\n\n\treturn h, nil\n}\n\n// LokiFromConfigLine returns a new logrus.Hook\n// that pushes logrus.Entrys to loki and is configured\n// through the provided line.\nfunc LokiFromConfigLine(fallbackLogger logrus.FieldLogger, line string) (AsyncHook, error) {\n\tvar opts LokiHookOptions\n\n\tif line != \"loki\" {\n\t\tlogOutput, _, _ := strings.Cut(line, \"=\")\n\t\tif logOutput != \"loki\" {\n\t\t\treturn nil, fmt.Errorf(\"loki configuration should be in the form `loki=url-to-push` but is `%s`\", line)\n\t\t}\n\n\t\tif err := opts.parseArgs(line); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn NewLokiHook(fallbackLogger, opts)\n}\n\nfunc (opts *LokiHookOptions) parseArgs(line string) error {\n\ttokens, err := strvals.Parse(line)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while parsing loki configuration %w\", err)\n\t}\n\n\tfor _, token := range tokens {\n\t\tkey := token.Key","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/log/loki.go#L114-L150","documentation":"A validation guard in LokiFromConfigLine. The --log-output value for Loki must be either bare `loki` or start with `loki=`; it fires when the prefix before '=' is not 'loki'. The at-fault input is the malformed log-output configuration line.","triggerScenarios":"Thrown at internal/log/loki.go:132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use --log-output=loki or --log-output=loki=url-to-push","Use the correct output type keyword for other outputs (stdout, file=...)","Check for typos or extra whitespace before '='"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}