From 465c5bcf80e5d1768bcd3ef7d0239d5cb5a0cab8 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Sat, 1 Sep 2018 16:07:32 -0400 Subject: [PATCH] Don't emit grok_exporter specific message in tailer package --- grok_exporter.go | 3 +++ tailer/fileTailer.go | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) 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 }