diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 6842832c6..d1563b1d5 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -428,7 +428,11 @@ func main() { // Throw error for invalid config before starting other components. var cfgFile *config.Config if cfgFile, err = config.LoadFile(cfg.configFile, agentMode, false, log.NewNopLogger()); err != nil { - level.Error(logger).Log("msg", fmt.Sprintf("Error loading config (--config.file=%s)", cfg.configFile), "err", err) + absPath, pathErr := filepath.Abs(cfg.configFile) + if pathErr != nil { + absPath = cfg.configFile + } + level.Error(logger).Log("msg", fmt.Sprintf("Error loading config (--config.file=%s)", cfg.configFile), "file", absPath, "err", err) os.Exit(2) } if cfg.tsdb.EnableExemplarStorage { diff --git a/promql/query_logger.go b/promql/query_logger.go index ecf93765c..2c324fb90 100644 --- a/promql/query_logger.go +++ b/promql/query_logger.go @@ -83,7 +83,11 @@ func logUnfinishedQueries(filename string, filesize int, logger log.Logger) { func getMMapedFile(filename string, filesize int, logger log.Logger) ([]byte, error) { file, err := os.OpenFile(filename, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0o666) if err != nil { - level.Error(logger).Log("msg", "Error opening query log file", "file", filename, "err", err) + absPath, pathErr := filepath.Abs(filename) + if pathErr != nil { + absPath = filename + } + level.Error(logger).Log("msg", "Error opening query log file", "file", absPath, "err", err) return nil, err }