mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-31 06:10:45 +00:00
chore: fix non linux build metrics
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
This commit is contained in:
@@ -22,7 +22,7 @@ limitations under the License.
|
||||
#include <libsinsp/utils.h>
|
||||
|
||||
#include <re2/re2.h>
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) and !defined(MINIMAL_BUILD) and !defined(__EMSCRIPTEN__)
|
||||
#include <openssl/sha.h>
|
||||
#endif
|
||||
#include <cstring>
|
||||
@@ -119,7 +119,7 @@ uint64_t parse_prometheus_interval(std::string interval_str)
|
||||
return interval;
|
||||
}
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) and !defined(MINIMAL_BUILD) and !defined(__EMSCRIPTEN__)
|
||||
std::string calculate_file_sha256sum(const std::string& filename)
|
||||
{
|
||||
std::ifstream file(filename, std::ios::binary);
|
||||
|
@@ -27,7 +27,7 @@ namespace falco::utils
|
||||
{
|
||||
uint64_t parse_prometheus_interval(std::string interval_str);
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) and !defined(MINIMAL_BUILD) and !defined(__EMSCRIPTEN__)
|
||||
std::string calculate_file_sha256sum(const std::string& filename);
|
||||
#endif
|
||||
|
||||
|
@@ -84,7 +84,7 @@ falco::app::run_result falco::app::actions::load_rules_files(falco::app::state&
|
||||
{
|
||||
falco_logger::log(falco_logger::level::WARNING,res->as_string(true, rc) + "\n");
|
||||
}
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) and !defined(MINIMAL_BUILD) and !defined(__EMSCRIPTEN__)
|
||||
s.config->m_loaded_rules_filenames_sha256sum.push_back(falco::utils::calculate_file_sha256sum(filename));
|
||||
#endif
|
||||
}
|
||||
|
@@ -161,7 +161,7 @@ void falco_configuration::merge_configs_files(const std::string& config_name, st
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) and !defined(MINIMAL_BUILD) and !defined(__EMSCRIPTEN__)
|
||||
for(auto &filename : m_loaded_configs_filenames)
|
||||
{
|
||||
m_loaded_configs_filenames_sha256sum.push_back(falco::utils::calculate_file_sha256sum(filename));
|
||||
|
@@ -84,7 +84,7 @@ std::string falco_metrics::to_text(const falco::app::state& state)
|
||||
prometheus_text += prometheus_metrics_converter.convert_metric_to_text_prometheus("kernel_release", "falcosecurity", "falco", {{"kernel_release", agent_info->uname_r}});
|
||||
prometheus_text += prometheus_metrics_converter.convert_metric_to_text_prometheus("hostname", "falcosecurity", "evt", {{"hostname", machine_info->hostname}});
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) and !defined(MINIMAL_BUILD) and !defined(__EMSCRIPTEN__)
|
||||
auto it_filename = state.config.get()->m_loaded_rules_filenames.begin();
|
||||
auto it_sha256 = state.config.get()->m_loaded_rules_filenames_sha256sum.begin();
|
||||
while (it_filename != state.config.get()->m_loaded_rules_filenames.end() && it_sha256 != state.config.get()->m_loaded_rules_filenames_sha256sum.end())
|
||||
|
@@ -330,7 +330,7 @@ void stats_writer::collector::get_metrics_output_fields_wrapper(
|
||||
output_fields["falco.host_num_cpus"] = machine_info->num_cpus;
|
||||
output_fields["falco.outputs_queue_num_drops"] = m_writer->m_outputs->get_outputs_queue_num_drops();
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) and !defined(MINIMAL_BUILD) and !defined(__EMSCRIPTEN__)
|
||||
auto it_filename = m_writer->m_config->m_loaded_rules_filenames.begin();
|
||||
auto it_sha256 = m_writer->m_config->m_loaded_rules_filenames_sha256sum.begin();
|
||||
while (it_filename != m_writer->m_config->m_loaded_rules_filenames.end() && it_sha256 != m_writer->m_config->m_loaded_rules_filenames_sha256sum.end())
|
||||
|
Reference in New Issue
Block a user