How to fetch distinct/unique values from logs?

Hi Community,

Is there any way to get the distinct/unique IPs from the logs? This query count the logs but I need it to be counting the unique IPs. I don’t see any operator to achieve this result.

count (
                count by (ip)(
                (
                        count_over_time({component="controller", instance="ingress-nginx"}
                        [$__interval])
                )
        )

Regards,
D

Hello,

Do capture the IPs as labels while collecting the logs?

If not, it possible to achieve what you need with LogQL pattern parser [and Grafana transformations].

Can you show us some of the logs?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.