mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-07 03:39:01 +00:00
chore: add environment variable FALCO_GRPC_HOSTNAME
Signed-off-by: Adrián Arroyo Calle <adrian.arroyocalle@gmail.com>
This commit is contained in:
parent
a084f17493
commit
52fbcefa1d
@ -147,10 +147,15 @@ void falco_outputs::handle_event(gen_event *ev, string &rule, string &source,
|
|||||||
std::lock_guard<std::mutex> guard(m_ls_semaphore);
|
std::lock_guard<std::mutex> guard(m_ls_semaphore);
|
||||||
lua_getglobal(m_ls, m_lua_output_event.c_str());
|
lua_getglobal(m_ls, m_lua_output_event.c_str());
|
||||||
char hostname[1024];
|
char hostname[1024];
|
||||||
int err = gethostname(hostname, sizeof(hostname));
|
char* env_hostname = getenv("FALCO_GRPC_HOSTNAME");
|
||||||
if(err != 0){
|
if(env_hostname == NULL){
|
||||||
string err = "Failed to get hostname";
|
int err = gethostname(hostname, sizeof(hostname));
|
||||||
throw falco_exception(err);
|
if(err != 0){
|
||||||
|
string err = "Failed to get hostname";
|
||||||
|
throw falco_exception(err);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
strcpy(hostname, env_hostname);
|
||||||
}
|
}
|
||||||
if(lua_isfunction(m_ls, -1))
|
if(lua_isfunction(m_ls, -1))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user