如何在splunk中匹配URI
how to matching URI in splunk
有一些域名。
主持人:random_doamin:8080
主持人:random_domain/hello
主持人:random_domain
主持人:http://random_doamin:8080
主机:https://random_domain/hello
这是我用于测试 splunk 的查询。
index=notable earliest=-1h | head 5
| eval domain1="Host: random_doamin:8080"
| eval domain2="Host: random_domain/hello"
| eval domain3="Host: random_domain"
| eval domain4="Host: http://random_doamin:8080"
| eval domain5="Host: https://random_domain/hello"
| eval isMalicious = mvappend('domain1', 'domain2', 'domain3', 'domain4', 'domain5')
| mvexpand isMalicious
| dedup isMalicious
| rex field=isMalicious "Host: (http://|https://)?(?<random_domain>.*(:|\/)?)"
| table isMalicious random_domain
查询结果如下
我想要的只是提取random_domain
如果这是不可能的,那么至少我想像下面这样提取
“random_domain:”或“random_domain/”
我需要你的帮助。
提前谢谢你的好意。
使用
Host: (?:https?://)?(?<random_domain>[^:/\s]+)
参见proof。
说明
--------------------------------------------------------------------------------
Host: 'Host: '
--------------------------------------------------------------------------------
(?: group, but do not capture (optional
(matching the most amount possible)):
--------------------------------------------------------------------------------
http 'http'
--------------------------------------------------------------------------------
s? 's' (optional (matching the most amount
possible))
--------------------------------------------------------------------------------
:// '://'
--------------------------------------------------------------------------------
)? end of grouping
有一些域名。
主持人:random_doamin:8080
主持人:random_domain/hello
主持人:random_domain
主持人:http://random_doamin:8080
主机:https://random_domain/hello
这是我用于测试 splunk 的查询。
index=notable earliest=-1h | head 5
| eval domain1="Host: random_doamin:8080"
| eval domain2="Host: random_domain/hello"
| eval domain3="Host: random_domain"
| eval domain4="Host: http://random_doamin:8080"
| eval domain5="Host: https://random_domain/hello"
| eval isMalicious = mvappend('domain1', 'domain2', 'domain3', 'domain4', 'domain5')
| mvexpand isMalicious
| dedup isMalicious
| rex field=isMalicious "Host: (http://|https://)?(?<random_domain>.*(:|\/)?)"
| table isMalicious random_domain
查询结果如下
我想要的只是提取random_domain
如果这是不可能的,那么至少我想像下面这样提取
“random_domain:”或“random_domain/”
我需要你的帮助。 提前谢谢你的好意。
使用
Host: (?:https?://)?(?<random_domain>[^:/\s]+)
参见proof。
说明
--------------------------------------------------------------------------------
Host: 'Host: '
--------------------------------------------------------------------------------
(?: group, but do not capture (optional
(matching the most amount possible)):
--------------------------------------------------------------------------------
http 'http'
--------------------------------------------------------------------------------
s? 's' (optional (matching the most amount
possible))
--------------------------------------------------------------------------------
:// '://'
--------------------------------------------------------------------------------
)? end of grouping