I'm looking for help on how to query all unique IP addresses, however, the field types that the IPs get parsed to are setup as "keyword" and not "IP". And they are setup as ip_src, ip_dst, dst_ip, src_ip.
Yes, I understand this probably isn't ideal, but this can't be changed and out of my control, so I'm hoping there is still a way to dump all the IPs seen in those fields. Also, can this be queried via a CIDR range. I'm thinking not since the fields are not set to "IP", but thought I'd ask.
Hi there ... I love these question because to me they lead to many more...
I will answer the first and easiest and show you cardinality and top hits (think unique) IPs.
(And yes converting these fields to actual ip data type would provide much more powerful searching and grouping but we can talk about that later, perhaps even how to do it after the data is ingested)
But when I read ALL, is all 1, 1000, 1,000,000 IPs do you really want to dump and display 1M IPs? Over what time frame? (BTW there are some limitation at extreme scale with aggregations which is what we are talking about be we will talk about that later if it comes up.
Typically folks are look at Top 100 Busy, Bottom 100 etc.. etc..
Also you can do this very easily in Lens Visualization it is built to answer these types of questions... You can build Tables or Bar charts etc... For almost every network team builds these kind of visualizations and table.
@stephenb Thanks for the quick reply. I'm actually looking to list out all the unique IPs. I have been able to use cardinality to get totals.
This query is just for demonstration purposes on lab equipment and wouldn't be used for thousands or more IPs.
Also, this query is going to be called from another non-kibana dashboard probably using curl to get this information. I did see that there is a "multi_terms" agg, but doesn't seem to be in version 7.11, so I got excited, then sad.
Below will give the actual IPs, you may need to page through them but I think you can use this up to 10,000 see below I set it too1000 that would give you up to 1000 unique IPs.
not sure what you want to do with multi_term ....
If you were on a newer version like 7.14.+ here is how to a runtime mapping and turn it into an actual ip data type but in 7.11 you would need to use and ingest pipeline and add the new fields.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.