fgerlits commented on code in PR #2007:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2007#discussion_r2304969249
##########
extensions/windows-event-log/ConsumeWindowsEventLog.cpp:
##########
@@ -95,14 +97,36 @@ void ConsumeWindowsEventLog::initialize() {
setSupportedRelationships(Relationships);
}
-bool ConsumeWindowsEventLog::insertHeaderName(wel::METADATA_NAMES &header,
const std::string &key, const std::string & value) {
- wel::METADATA name =
wel::WindowsEventLogMetadata::getMetadataFromString(key);
+wel::HeaderNames ConsumeWindowsEventLog::createHeaderNames(const
std::optional<std::string>& event_header_property) const {
+ if (!event_header_property) { return {}; }
+
+ wel::HeaderNames header_names;
+
+ const auto insert_header_name = [&header_names](const std::string& key,
const std::string& value) {
+ if (auto metadata = magic_enum::enum_cast<wel::Metadata>(key); metadata) {
+ header_names.emplace_back(*metadata, value);
+ return true;
+ }
+ return false;
+ };
- if (name != wel::METADATA::UNKNOWN) {
- header.emplace_back(std::make_pair(name, value));
- return true;
+ auto key_value_pairs = utils::string::split(*event_header_property, ",");
+ for (const auto& key_value_pair : key_value_pairs) {
+ auto key_value = utils::string::split(key_value_pair, "=");
+ if (key_value.size() == 2) {
+ auto key = utils::string::trim(key_value.at(0));
+ auto value = utils::string::trim(key_value.at(1));
Review Comment:
done: f59b9a5750162c96cc9d23edd6e5bc4a74daae99
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]