簡體   English   中英

如何在Elastic Stack中索引正則表達式?

[英]How do I index regular expressions in Elastic Stack?

使用ELK / Elastic Stack進行日志管理,我想基於如下日志行構建報告:

2018-01-31 11:50:00.212 Loading the user images took 234 ms 
2018-01-31 10:23:01.984 Loading the user images took 331 ms 
2018-01-31 10:12:41.323 Loading the user images took 512 ms 

因此,該報告將采取與串線Loading the user images took

然后,正則表達式將提取/took (\\d+) ms/並構建圖表或通知。

我該怎么做呢? 也許這涉及以某種方式定義索引?

我會使用logstash grok過濾器。

https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html

使用此站點以用戶友好的方式測試您的grok模式:

http://grokconstructor.appspot.com/do/match

我做了一個將ms提取到timeTaken字段的模式:

%{GREEDYDATA}took %{NUMBER:timeTaken}

如果需要更多數據,請使用在線頁面進行測試並搜索grok模式。 可視化在Kibana中完成。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM