如何使用 Kibana + Elastic Search 检索字段的唯一计数 [英] How to retrieve unique count of a field using Kibana + Elastic Search
问题描述
是否可以使用 Kibana 查询字段的不同/唯一计数?我使用弹性搜索作为 Kibana 的后端.
Is it possible to query for a distinct/unique count of a field using Kibana? I am using elastic search as my backend to Kibana.
如果是,查询的语法是什么?这是我想查询的 Kibana 界面的链接:http://demo.kibana.org/#/dashboard一个>
If so, what is the syntax of the query? Heres a link to the Kibana interface I would like to make my query: http://demo.kibana.org/#/dashboard
我正在使用 logstash 解析 nginx 访问日志并将数据存储到弹性搜索中.然后,我使用 Kibana 运行查询并在图表中可视化我的数据.具体来说,我想知道使用 Kibana 的特定时间范围内唯一 IP 地址的数量.
I am parsing nginx access logs with logstash and storing the data into elastic search. Then, I use Kibana to run queries and visualize my data in charts. Specifically, I want to know the count of unique IP addresses for a specific time frame using Kibana.
推荐答案
对于 Kibana 4,请转到 这个答案
使用术语面板很容易做到这一点:
This is easy to do with a terms panel:
如果你想选择你的日志中不同IP的数量,你应该在字段clientip
中指定,你应该在长度上输入一个足够大的数字(否则它会加入不同的同一组下的IP)并在样式表中指定.添加面板后,您将拥有一个包含 IP 和该 IP 计数的表格:
If you want to select the count of distinct IP that are in your logs, you should specify in the field clientip
, you should put a big enough number in length (otherwise, it will join different IP under the same group) and specify in the style table. After adding the panel, you will have a table with IP, and the count of that IP:
这篇关于如何使用 Kibana + Elastic Search 检索字段的唯一计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!