diff --git a/lib/logreader.c b/lib/logreader.c index c8747e463..35fd7de28 100644 --- a/lib/logreader.c +++ b/lib/logreader.c @@ -389,6 +389,11 @@ log_reader_work_finished(void *s, gpointer arg) self->notify_code = 0; log_pipe_notify(self->control, notify_code, self); + + if (notify_code == NC_CLOSE && (self->options->flags & LR_EXIT_ON_EOF)) + { + cfg_shutdown(log_pipe_get_config(s)); + } } if ((self->super.super.flags & PIF_INITIALIZED) && self->proto) { @@ -868,6 +873,7 @@ CfgFlagHandler log_reader_flag_handlers[] = { "empty-lines", CFH_SET, offsetof(LogReaderOptions, flags), LR_EMPTY_LINES }, { "threaded", CFH_SET, offsetof(LogReaderOptions, flags), LR_THREADED }, { "ignore-aux-data", CFH_SET, offsetof(LogReaderOptions, flags), LR_IGNORE_AUX_DATA }, + { "exit-on-eof", CFH_SET, offsetof(LogReaderOptions, flags), LR_EXIT_ON_EOF }, { NULL }, }; diff --git a/lib/logreader.h b/lib/logreader.h index 6c633314c..2d3b51f75 100644 --- a/lib/logreader.h +++ b/lib/logreader.h @@ -39,6 +39,7 @@ #define LR_EMPTY_LINES 0x0004 #define LR_IGNORE_AUX_DATA 0x0008 #define LR_THREADED 0x0040 +#define LR_EXIT_ON_EOF 0x0080 /* options */ diff --git a/modules/affile/file-reader.c b/modules/affile/file-reader.c index 4c6af0ae2..7439d6dd5 100644 --- a/modules/affile/file-reader.c +++ b/modules/affile/file-reader.c @@ -267,8 +267,6 @@ file_reader_notify_method(LogPipe *s, gint notify_code, gpointer user_data) switch (notify_code) { case NC_CLOSE: - if (self->options->exit_on_eof) - cfg_shutdown(log_pipe_get_config(s)); break; case NC_FILE_MOVED: diff --git a/modules/affile/file-reader.h b/modules/affile/file-reader.h index 009190824..05a8795c0 100644 --- a/modules/affile/file-reader.h +++ b/modules/affile/file-reader.h @@ -32,7 +32,6 @@ typedef struct _FileReaderOptions gint multi_line_timeout; gboolean restore_state; LogReaderOptions reader_options; - gboolean exit_on_eof; } FileReaderOptions; typedef struct _FileReader diff --git a/modules/affile/stdin.c b/modules/affile/stdin.c index 9dcc07d24..b2be7e1be 100644 --- a/modules/affile/stdin.c +++ b/modules/affile/stdin.c @@ -60,7 +60,7 @@ stdin_sd_new(GlobalConfig *cfg) { AFFileSourceDriver *self = affile_sd_new_instance("-", cfg); - self->file_reader_options.exit_on_eof = TRUE; + self->file_reader_options.reader_options.flags |= LR_EXIT_ON_EOF; self->file_reader_options.reader_options.super.stats_source = stats_register_type("stdin"); self->file_opener = file_opener_for_stdin_new(); affile_sd_set_transport_name(self, "local+stdin");