diff --git a/grok_exporter.go b/grok_exporter.go index 21600a8a..c713a5b6 100644 --- a/grok_exporter.go +++ b/grok_exporter.go @@ -77,6 +77,9 @@ func main() { case err := <-serverErrors: exitOnError(fmt.Errorf("server error: %v", err.Error())) case err := <-tail.Errors(): + if os.IsNotExist(err) { + exitOnError(fmt.Errorf("error reading log lines: %v. use 'fail_on_missing_logfile: false' in the input configuration if you want grok_exporter to start even though the logfile is missing", err)) + } exitOnError(fmt.Errorf("error reading log lines: %v", err.Error())) case line := <-tail.Lines(): matched := false diff --git a/tailer/fileTailer.go b/tailer/fileTailer.go index 9ec4257a..95975c49 100644 --- a/tailer/fileTailer.go +++ b/tailer/fileTailer.go @@ -180,9 +180,6 @@ func openLogfile(path string, readall bool, failOnMissingFile bool) (*File, stri } file, err := open(abspath) if err != nil { - if failOnMissingFile && os.IsNotExist(err) { - return nil, "", fmt.Errorf("%v. use 'fail_on_missing_logfile: false' in the input configuration if you want grok_exporter to start even though the logfile is missing", err) - } if failOnMissingFile || !os.IsNotExist(err) { return nil, "", err }