grafana/k6 · error
logfile configuration should be in the form `file=path-to-lo
Error message
logfile configuration should be in the form `file=path-to-local-file` but is `%s`
What it means
A validation guard in FileHookFromConfigLine. The --log-output flag for file logging must be exactly `file=path`; it fires when the prefix before '=' is not 'file' (e.g. a malformed line or a different output type routed here). The at-fault input is the whole log-output configuration line.
Source
Thrown at internal/log/file.go:50
bw *bufio.Writer
levels []logrus.Level
}
// FileHookFromConfigLine returns new fileHook hook.
func FileHookFromConfigLine(
fs fsext.Fs, getCwd func() (string, error),
fallbackLogger logrus.FieldLogger, line string,
) (AsyncHook, error) {
hook := &fileHook{
fs: fs,
fallbackLogger: fallbackLogger,
levels: logrus.AllLevels,
loglines: make(chan []byte, fileHookBufferSize),
}
logOutput, _, _ := strings.Cut(line, "=")
if logOutput != "file" {
return nil, fmt.Errorf("logfile configuration should be in the form `file=path-to-local-file` but is `%s`", line)
}
if err := hook.parseArgs(line); err != nil {
return nil, err
}
if err := hook.openFile(getCwd); err != nil {
return nil, err
}
return hook, nil
}
func (h *fileHook) parseArgs(line string) error {
tokens, err := strvals.Parse(line)
if err != nil {
return fmt.Errorf("error while parsing logfile configuration %w", err)
}
for _, token := range tokens {
switch token.Key {View on GitHub (pinned to 01ffac6f24)
Solutions
- Use the format file=path-to-local-file for --log-output
- Do not pass other output kinds to the file hook; use the appropriate --log-output value (e.g. stdout, loki)
- Check for typos or extra whitespace before '='
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/log/file.go:50 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/fddc328a0892d724.
Report an issue: GitHub.