Github user nickwallen commented on a diff in the pull request: https://github.com/apache/metron-bro-plugin-kafka/pull/6#discussion_r172193204 --- Diff: src/KafkaWriter.cc --- @@ -54,20 +66,49 @@ KafkaWriter::KafkaWriter(WriterFrontend* frontend): WriterBackend(frontend), for } KafkaWriter::~KafkaWriter() -{} +{ + + // Cleanup all the things + delete topic; + delete producer; + delete formatter; + delete conf; + delete topic_conf; + +} bool KafkaWriter::DoInit(const WriterInfo& info, int num_fields, const threading::Field* const* fields) { + // Timeformat object, default to TS_EPOCH + threading::formatter::JSON::TimeFormat tf = threading::formatter::JSON::TS_EPOCH; + // if no global 'topic_name' is defined, use the log stream's 'path' if(topic_name.empty()) { topic_name = info.path; } + // format timestamps + if ( strcmp(json_timestamps.c_str(), "JSON::TS_EPOCH") == 0 ) { + tf = threading::formatter::JSON::TS_EPOCH; + } + else if ( strcmp(json_timestamps.c_str(), "JSON::TS_MILLIS") == 0 ) { + tf = threading::formatter::JSON::TS_MILLIS; + } + else if ( strcmp(json_timestamps.c_str(), "JSON::TS_ISO8601") == 0 ) { + tf = threading::formatter::JSON::TS_ISO8601; + } + else + { --- End diff -- Small nit: Can we join the open paren to the line above just to match the rest of the code style. Gracias.
---