Skip to content
Advertisement

SQL query, counting IP-Adress (Grafana, DMARC)

Maybe this question exists, but I couldt find it so you can also just link me to a similar question.

My problem: I have a database and wand to visualize it with Grafana. In Grafana you have the option to create a query in SQL notation. In my case I want to count the similar IP addresses I have in my DB and also order them desc. The only problem is that I have IP addresses with different host-parts, which i want to ignore, like: 183.34.111.188; 183.34.111.172; 183.34.111.42 should be counted as three times “183.34.111”.

You guys have any Idea how I can solve this? This is the SQL (standard) Code in Grafana to count:

Thank you

Advertisement

Answer

This is the Answer of my question, you can remove the last part with “.0/24” if you want. It only makes sense on IPv4 addresses, because you look at a IP-Address Range. IDK how you Group a Range for IPv6.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement