diff --git a/src/logging/Manager.cc b/src/logging/Manager.cc index cfa8466198..a3d5471c2e 100644 --- a/src/logging/Manager.cc +++ b/src/logging/Manager.cc @@ -1709,6 +1709,7 @@ WriterFrontend* Manager::CreateWriterForFilter(Filter* filter, const std::string auto* info = new WriterBackend::WriterInfo; info->path = util::copy_string(path.c_str(), path.size()); + info->filter_name = filter->name; info->network_time = run_state::network_time; auto* filter_config_table = filter->config->AsTable(); diff --git a/src/logging/WriterBackend.h b/src/logging/WriterBackend.h index 3cb09d2584..cf32dd4f6e 100644 --- a/src/logging/WriterBackend.h +++ b/src/logging/WriterBackend.h @@ -67,6 +67,11 @@ public: */ const char* path; + /** + * The filter this writer is attached to. + */ + std::string filter_name; + /** * The name of the postprocessor function that will be called * upon the logging manager processing the "rotation finished" @@ -108,6 +113,8 @@ public: for ( config_map::const_iterator i = other.config.begin(); i != other.config.end(); i++ ) config.insert(std::make_pair(util::copy_string(i->first), util::copy_string(i->second))); + + filter_name = other.filter_name; } ~WriterInfo() { diff --git a/src/logging/WriterFrontend.h b/src/logging/WriterFrontend.h index a8c565cd24..2f3590b749 100644 --- a/src/logging/WriterFrontend.h +++ b/src/logging/WriterFrontend.h @@ -238,6 +238,11 @@ public: */ const char* Name() const { return name; } + /** + * Returns the name of the filter for which this frontend was instantiated. + */ + const std::string& GetFilterName() const { return info->filter_name; } + /** * Returns the log fields as passed into the constructor. */