update embedded nginx support for openappsec and bug fixes and schema changes

This commit is contained in:
dgambarin
2022-11-16 17:56:41 +02:00
parent 03949a3cb7
commit 8bbd856d92
13 changed files with 90 additions and 48 deletions

View File

@@ -80,7 +80,11 @@ public:
_severity,
_priority,
std::chrono::seconds(0),
LogField("agentId", Singleton::Consume<I_AgentDetails>::by<LogGen>()->getAgentId()),
LogField(
"agentId",
(Report::isPlaygroundEnv() ? "playground-" : "") +
Singleton::Consume<I_AgentDetails>::by<LogGen>()->getAgentId()
),
std::forward<Args>(args)...
)
{

View File

@@ -16,6 +16,10 @@
#include <set>
#include <chrono>
#include <stdlib.h>
#include <algorithm>
#include <cctype>
#include <iostream>
#include "report/base_field.h"
#include "report/report_enums.h"
@@ -71,6 +75,26 @@ public:
setInstanceAwareness();
}
static bool
isPlaygroundEnv()
{
std::string playground_variable = "PLAYGROUND";
const char *env_string = getenv(playground_variable.c_str());
if (env_string) {
std::string env_value = env_string;
std::transform(
env_value.begin(),
env_value.end(),
env_value.begin(),
[](unsigned char c){ return std::tolower(c); }
);
return env_value == "true";
}
return false;
}
void serialize(cereal::JSONOutputArchive &ar) const;
std::string getSyslog() const;
std::string getCef() const;