diff --git a/containers/container.go b/containers/container.go index b3fb8c68..f239a4bd 100644 --- a/containers/container.go +++ b/containers/container.go @@ -370,8 +370,7 @@ func (c *Container) Collect(ch chan<- prometheus.Metric) { } } for _, c := range p.parser.GetSensitiveCounters() { - log.Printf("sensitive log message: %s", c.Pattern) - ch <- counter(metrics.SensitiveLogMessages, float64(c.Messages), source, c.Pattern, c.Sample) + ch <- counter(metrics.SensitiveLogMessages, float64(c.Messages), source, c.Pattern, c.Sample, c.Regex, c.Name) } } diff --git a/containers/metrics.go b/containers/metrics.go index 9156797e..1e0c2a07 100644 --- a/containers/metrics.go +++ b/containers/metrics.go @@ -88,7 +88,7 @@ var metrics = struct { NetBytesReceived: metric("container_net_tcp_bytes_received_total", "Total number of bytes received from the peer", "destination", "actual_destination", "src_workload_name", "src_workload_namespace", "src_workload_kind", "destination_workload_name", "destination_workload_namespace", "destination_workload_kind", "actual_destination_workload_name", "actual_destination_workload_namespace", "actual_destination_workload_kind"), LogMessages: metric("container_log_messages_total", "Number of messages grouped by the automatically extracted repeated pattern", "source", "level", "pattern_hash", "sample"), - SensitiveLogMessages: metric("container_sensitive_log_messages_total", "Number of messages that contain sensitive information", "source", "pattern", "sample"), + SensitiveLogMessages: metric("container_sensitive_log_messages_total", "Number of messages that contain sensitive information", "source", "pattern", "sample", "regex", "name"), ApplicationType: metric("container_application_type", "Type of the application running in the container (e.g. memcached, postgres, mysql)", "application_type"), diff --git a/go.mod b/go.mod index 21d5708d..f7b5da9b 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.5 github.com/jpillora/backoff v1.0.0 github.com/mdlayher/taskstats v0.0.0-20230712191918-387b3d561d14 - github.com/nudgebee/logparser v0.0.0-20241210142322-b2bd9d573f94 + github.com/nudgebee/logparser v0.0.0-20241211102337-637d710a1162 github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 github.com/prometheus/client_golang v1.18.0 github.com/prometheus/common v0.46.0 diff --git a/go.sum b/go.sum index 9b6984fe..5cc500a5 100644 --- a/go.sum +++ b/go.sum @@ -841,6 +841,10 @@ github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nudgebee/logparser v0.0.0-20241210142322-b2bd9d573f94 h1:Cawv/bZ93Oy9pOizk4NpAkSq/pbA6K5HfIK/s2sNs6s= github.com/nudgebee/logparser v0.0.0-20241210142322-b2bd9d573f94/go.mod h1:ddmUa8en2sToRL+bBvFkuS1AHvA6Msn56v3BpLMbKoc= +github.com/nudgebee/logparser v0.0.0-20241211095040-6f2c19b5d944 h1:xxKNjxg85roYcNLJe0RgOlrdMtNkZNkHv+0dDcHAsIE= +github.com/nudgebee/logparser v0.0.0-20241211095040-6f2c19b5d944/go.mod h1:ddmUa8en2sToRL+bBvFkuS1AHvA6Msn56v3BpLMbKoc= +github.com/nudgebee/logparser v0.0.0-20241211102337-637d710a1162 h1:0NAxxCRfdUfZdXhgiy+PPytEXxGJuYsf5IGzx1DcjFU= +github.com/nudgebee/logparser v0.0.0-20241211102337-637d710a1162/go.mod h1:ddmUa8en2sToRL+bBvFkuS1AHvA6Msn56v3BpLMbKoc= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=