我正在尝试使用Splunk搜索特定url的所有基本路径实例(并可能随后将其绘制在图表上)。
以下是一些示例网址以及我要匹配的部分:
http://some-url.com/first/ # match "first"
http://some-url.com/first/second/ # match "first"
http://some-url.com/first/second/third/ # match "first"
这是我使用的正则表达式,可以正常工作:
http:\/\/some-url\.com\/(.*?)\/
我的Splunk搜索应如何提取所需的文本?在Splunk中甚至有可能吗?
答案 0 :(得分:0)
假定它始终为implementation "com.android.support:appcompat-v7:27.1.1"
。
使用rex:
implementation "com.android.support:appcompat-v7:28.0.0"
答案 1 :(得分:0)
要匹配任何URL(是否为.com),您可以使用以下命令。
index=... | rex field=_raw "http(s)?://[^/]+/(?<match>[^/]+)"
这将与
之类的东西匹配http://splunk.com/first/
https://simonduff.net/first/
https://splunk.com/first/middle/last
https://splunk.com/first