diff --git a/userspace/libpman/src/maps.c b/userspace/libpman/src/maps.c index 9ab64eb664..861975f344 100644 --- a/userspace/libpman/src/maps.c +++ b/userspace/libpman/src/maps.c @@ -172,7 +172,7 @@ static int add_bpf_program_to_tail_table(int tail_table_fd, const char* bpf_prog if(!bpf_prog) { snprintf(error_message, MAX_ERROR_MESSAGE_LEN, "unable to find BPF program '%s'", bpf_prog_name); - pman_print_error((const char*)error_message); + pman_print_msg(FALCOSECURITY_LOG_SEV_DEBUG, (const char*)error_message); /* * It's not a hard failure, as programs could be excluded from the diff --git a/userspace/libpman/src/state.c b/userspace/libpman/src/state.c index 91938814ea..687d061b1b 100644 --- a/userspace/libpman/src/state.c +++ b/userspace/libpman/src/state.c @@ -25,7 +25,7 @@ limitations under the License. struct internal_state g_state = {}; -static void log_error(const char* fmt, ...) +static void log_msg(enum falcosecurity_log_severity level, const char* fmt, ...) { va_list args; va_start(args, fmt); @@ -34,7 +34,7 @@ static void log_error(const char* fmt, ...) { char buf[MAX_ERROR_MESSAGE_LEN]; vsnprintf(buf, sizeof(buf), fmt, args); - g_state.log_fn("libpman", buf, FALCOSECURITY_LOG_SEV_ERROR); + g_state.log_fn("libpman", buf, level); } else { @@ -47,6 +47,11 @@ static void log_error(const char* fmt, ...) } void pman_print_error(const char* error_message) +{ + pman_print_msg(FALCOSECURITY_LOG_SEV_ERROR, error_message); +} + +void pman_print_msg(enum falcosecurity_log_severity level, const char* error_message) { if(!error_message) { @@ -63,10 +68,10 @@ void pman_print_error(const char* error_message) * for this error code. */ const char* err_str = (errno == ESRCH) ? "Object not found" : strerror(errno); - log_error("%s (errno: %d | message: %s)", error_message, errno, err_str); + log_msg(level, "%s (errno: %d | message: %s)", error_message, errno, err_str); } else { - log_error("%s", error_message); + log_msg(level, "%s", error_message); } } diff --git a/userspace/libpman/src/state.h b/userspace/libpman/src/state.h index 4c53391593..b8b3fd1d03 100644 --- a/userspace/libpman/src/state.h +++ b/userspace/libpman/src/state.h @@ -65,3 +65,4 @@ struct internal_state extern struct internal_state g_state; extern void pman_print_error(const char* error_message); +extern void pman_print_msg(enum falcosecurity_log_severity level, const char* error_message);