Github user dcode commented on a diff in the pull request: https://github.com/apache/metron-bro-plugin-kafka/pull/6#discussion_r172229125 --- 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 ) { --- End diff -- I copied this approach from the ASCII log writer here: https://github.com/bro/bro/blob/fc33bf2014704fe0ae512b76dae64de7fc5e83ac/src/logging/writers/ascii/Ascii.cc#L166-L176 I don't think BinPac can pass through a BinPac enum to a C++ enum. Bro enums are defined at runtime, whereas C++ is a compile-time definition. If you can point to an example to make this work, I'm happy to do it. The C API for BinPac isn't extremely well documented :face_with_head_bandage:
---