fix(userspace/falco): remove syslog on windows

Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
This commit is contained in:
Roberto Scolaro 2023-10-24 16:57:39 +00:00 committed by poiana
parent 00a87234ce
commit af70b4e770
3 changed files with 17 additions and 0 deletions

View File

@ -144,6 +144,7 @@ void falco_logger::log(int priority, const std::string&& msg)
std::string copy = msg;
#ifndef _WIN32
if (falco_logger::log_syslog)
{
// Syslog output should not have any trailing newline
@ -154,6 +155,7 @@ void falco_logger::log(int priority, const std::string&& msg)
::syslog(priority, "%s", copy.c_str());
}
#endif
if (falco_logger::log_stderr)
{

View File

@ -18,7 +18,18 @@ limitations under the License.
#pragma once
#include "sinsp.h"
#ifdef _WIN32
#define LOG_EMERG 0
#define LOG_ALERT 1
#define LOG_CRIT 2
#define LOG_ERR 3
#define LOG_WARNING 4
#define LOG_NOTICE 5
#define LOG_INFO 6
#define LOG_DEBUG 7
#else
#include <syslog.h>
#endif
class falco_logger
{

View File

@ -16,10 +16,14 @@ limitations under the License.
*/
#include "outputs_syslog.h"
#ifndef _WIN32
#include <syslog.h>
#endif
void falco::outputs::output_syslog::output(const message *msg)
{
#ifndef _WIN32
// Syslog output should not have any trailing newline
::syslog(msg->priority, "%s", msg->msg.c_str());
#endif
}