mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-27 07:07:23 +00:00
add useragent string to output
Signed-off-by: Marcin Kowalski <marcin.kowalski@assecobs.pl>
This commit is contained in:
parent
3e9f8c1ef1
commit
a94e6de458
@ -148,6 +148,10 @@ void falco_configuration::init(string conf_filename, list<string> &cmdline_optio
|
|||||||
}
|
}
|
||||||
http_output.options["url"] = url;
|
http_output.options["url"] = url;
|
||||||
|
|
||||||
|
string user_agent;
|
||||||
|
user_agent = m_config->get_scalar<string>("http_output.user_agent","falcosecurity/falco");
|
||||||
|
http_output.options["user_agent"] = user_agent;
|
||||||
|
|
||||||
m_outputs.push_back(http_output);
|
m_outputs.push_back(http_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,11 +34,14 @@ void falco::outputs::output_http::output(const message *msg)
|
|||||||
} else {
|
} else {
|
||||||
slist1 = curl_slist_append(slist1, "Content-Type: text/plain");
|
slist1 = curl_slist_append(slist1, "Content-Type: text/plain");
|
||||||
}
|
}
|
||||||
|
slist1 = curl_slist_append(slist1, m_oc.options["user_agent"].c_str());
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist1);
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist1);
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, m_oc.options["url"].c_str());
|
curl_easy_setopt(curl, CURLOPT_URL, m_oc.options["url"].c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, msg->msg.c_str());
|
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, msg->msg.c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, -1L);
|
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, -1L);
|
||||||
|
|
||||||
|
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
|
|
||||||
if(res != CURLE_OK)
|
if(res != CURLE_OK)
|
||||||
@ -50,4 +53,4 @@ void falco::outputs::output_http::output(const message *msg)
|
|||||||
curl_slist_free_all(slist1);
|
curl_slist_free_all(slist1);
|
||||||
slist1 = NULL;
|
slist1 = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user