任何人都可以提供一个REST API列表来查询elasticsearch吗?
问题描述:
- 我试图把我的日志,通过对logstash elasticsearch。
-
我
logstash.conf
有2个日志文件作为输入;弹性搜索作为输出;和grok作为过滤器。这里是我的神交比赛:任何人都可以提供一个REST API列表来查询elasticsearch吗?grok { match => [ "message", "(?<timestamp>[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}) (?:\[%{GREEDYDATA:caller_thread}\]) (?:%{LOGLEVEL:level}) (?:%{DATA:caller_class})(?:\-%{GREEDYDATA:message})" ] }
当elasticsearch开始时,我的所有日志添加为
logstash.conf
提到elasticsearch服务器配有独立的索引名。- 我的疑问是,我的日志是如何存储在elasticsearch中的?我只知道它与logstash中提到的索引名称一起存储。
'http://164.99.178.18:9200/_cat/indices?v' API给我以下:
健康状况指标PRI代表docs.count docs.deleted store.size pri.store.size
yellow open tomcat-log 5 1 6478 0 1.9mb 1.9mb
yellow open apache-log 5 1 212 0 137kb
137kb
- 但是,在我的日志的elasticsearch中如何创建”文档“,”字段“。
,我读了elasticsearch是基于REST的搜索引擎。因此,如果有任何REST API可用于在elasticsearch中分析我的数据。
答
确实。
curl localhost:9200/tomcat-log/_search
会给你回头的10个文件,但也是你的索引文件的总数。
curl localhost:9200/tomcat-log/_search -d '{
"query": {
"match": {
"level" : "error"
}
}
}'
可能会给你所有的文档在tomcat日志中有等级的错误。
看一看book的这一部分。我会帮你的。
+0
是的,我会将curl localhost:9200/tomcat-log/_mapping添加到工具箱以及映射索引中的所有字段。 –
参考http://*.com/questions/1323449/tool-to-measure-render-time – BlackPOP