From 03f4d6bf39f16b66ea06a76180212a0c87cb1bf2 Mon Sep 17 00:00:00 2001 From: Ned Wright Date: Tue, 7 Mar 2023 16:30:42 +0000 Subject: [PATCH] Replace LogGen with direct send of report to fog --- .../orchestration/orchestration_comp.cc | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/components/security_apps/orchestration/orchestration_comp.cc b/components/security_apps/orchestration/orchestration_comp.cc index f02a17a..a456bc8 100755 --- a/components/security_apps/orchestration/orchestration_comp.cc +++ b/components/security_apps/orchestration/orchestration_comp.cc @@ -1349,13 +1349,41 @@ private: } if (email != "") { dbgInfo(D_ORCHESTRATOR) << "Sending registration data"; - LogGen( - "Local Agent Data", - Audience::INTERNAL, - Severity::INFO, - Priority::LOW, - Tags::ORCHESTRATOR - ) << LogField("userDefinedId", email); + Singleton::Consume::by()->addOneTimeRoutine( + I_MainLoop::RoutineType::Offline, + [email] () + { + chrono::microseconds curr_time = Singleton::Consume::by()->getWalltime(); + + Report registration_report( + "Local Agent Data", + Singleton::Consume::by()->getWalltime(), + Type::EVENT, + Level::LOG, + LogLevel::INFO, + Audience::INTERNAL, + AudienceTeam::NONE, + Severity::INFO, + Priority::LOW, + chrono::seconds(0), + LogField("agentId", Singleton::Consume::by()->getAgentId()), + Tags::ORCHESTRATOR + ); + registration_report << LogField("userDefinedId", email); + + LogRest registration_report_rest(registration_report); + + Singleton::Consume::by()->sendObjectWithPersistence( + registration_report_rest, + I_Messaging::Method::POST, + "/api/v1/agents/events", + "", + true, + MessageTypeTag::REPORT + ); + }, + "Send registration data" + ); } reportAgentDetailsMetaData();