File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -577,6 +577,10 @@ const char config_schema_string[] = LONG_STRING_CONST(
577577 },
578578 "jemalloc_stats_enabled ": {
579579 "type ": "boolean "
580+ },
581+ "include_k8s_metadata ": {
582+ "type ": "boolean ",
583+ "default ": false
580584 }
581585 },
582586 "minProperties ": 1 ,
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ falco_configuration::falco_configuration():
9696 m_metrics_flags(0 ),
9797 m_metrics_convert_memory_to_mb(true ),
9898 m_metrics_include_empty_values(false ),
99+ m_include_k8s_metadata(false ),
99100 m_plugins_hostinfo(true ),
100101 m_capture_enabled(false ),
101102 m_capture_path_prefix(" /tmp/falco" ),
@@ -563,6 +564,7 @@ void falco_configuration::load_yaml(const std::string &config_name) {
563564 m_base_syscalls_all = m_config.get_scalar <bool >(" base_syscalls.all" , false );
564565
565566 m_metrics_enabled = m_config.get_scalar <bool >(" metrics.enabled" , false );
567+ m_include_k8s_metadata = m_config.get_scalar <bool >(" metrics.include_k8s_metadata" , false );
566568 m_metrics_interval_str = m_config.get_scalar <std::string>(" metrics.interval" , " 5000" );
567569 m_metrics_interval = falco::utils::parse_prometheus_interval (m_metrics_interval_str);
568570 m_metrics_stats_rule_enabled = m_config.get_scalar <bool >(" metrics.output_rule" , false );
Original file line number Diff line number Diff line change @@ -190,6 +190,7 @@ class falco_configuration {
190190 uint32_t m_metrics_flags;
191191 bool m_metrics_convert_memory_to_mb;
192192 bool m_metrics_include_empty_values;
193+ bool m_include_k8s_metadata;
193194 std::vector<plugin_config> m_plugins;
194195 bool m_plugins_hostinfo;
195196
Original file line number Diff line number Diff line change @@ -206,6 +206,12 @@ std::string falco_metrics::falco_to_text_prometheus(
206206 {" priority" , std::to_string (rule->priority )},
207207 {" source" , rule->source },
208208 };
209+ if (state.config ->m_include_k8s_metadata ) {
210+ // Kubernetes metadata is not available at metrics aggregation level.
211+ // Expose placeholder labels for consistency with other Falco outputs.
212+ const_labels[" k8s_ns_name" ] = " n/a" ;
213+ const_labels[" k8s_pod_name" ] = " n/a" ;
214+ }
209215 std::for_each (rule->tags .cbegin (),
210216 rule->tags .cend (),
211217 [&const_labels](std::string const & tag) {
You can’t perform that action at this time.
0 commit comments