【发布时间】:2018-11-21 03:55:45
【问题描述】:
我正在使用 Elasticsearch 检索一些日志:
http://localhost:9200/collection/_search?q=type:"log"
它给我带来了一些这样的热门歌曲:
{
"_index": "collection",
"_type": "doc",
"_id": "UL878GMBYKUUOvfyQJWl",
"_score": 6.487114,
"_source": {
"@version": "1",
"type": "log",
"message": "64.242.88.10;[07/Mar/2004:16:11:58 -0800];"GET /twiki/bin/view/TWiki/WikiSyntax HTTP/1.1\"; 200 7352\r",
"@timestamp": "2018-06-11T19:03:23.163Z",
"host": "logstash",
"path": "/opt/access_log.log"
}
}
每个命中都有一个“消息”,就像 CSV“access_log.log”中的一行。
但是每个有用的信息都在“消息”中,只是一个大字符串。所以我需要以某种方式提取以识别服务器IP(64.242.88.10)。
如何使用“;”分割这个“消息”字符串作为正则表达式,这样我就可以只获取我需要的数据?
【问题讨论】:
标签: elasticsearch logstash elasticsearch-5 elasticsearch-plugin