我正在使用Splunk仪表板将键值日志文件解析为表。
这是我正在使用的搜索:
...
<row>
<panel>
<title>Regdata Recon</title>
<table>
<search>
<query>REGDATA-RECON reconStartTime
| eval reconStartTime1=strptime('reconStartTime', "%Y-%m-%dT%H-%M-%S.%Q") <-- this is the format from the log
| eval reconEndTime1=strptime('reconEndTime', "%Y-%m-%dT%H-%M-%S.%Q")
| eval reconStart=strftime('reconStartTime1', "%Y-%m-%d %H:%M:%S")
| eval reconEnd=strftime('reconEndTime1', "%Y-%m-%d %H:%M:%S")
| fields - reconStartTime1 - reconEndTime1
| table environment,reconStart,reconEnd,Duration,result
| sort reconStart</query>
<earliest>$timeRange.earliest$</earliest>
<latest>$timeRange.latest$</latest>
<sampleRatio>1</sampleRatio>
</search>
...
</table>
</panel>
</row>
但是,虽然日志文件中有很多行可以满足此搜索,但我的仪表板给我的表只有一行。我想要一个表格,每一行都有行,就像在日志中那样。
我在做什么错?
更新:
事实是splunk将整个.log文件视为一个事件。文件中的所有行都一起查看,而不是分开查看。
关于将日志文件上传到splunk或关于splunk解释日志文件的操作已关闭。 (我说该文件应被视为sourcetype = log2metrics_keyvalue)
请帮助。
也许您可以使用正确的分隔符尝试类似的操作:|eval rows=split(_raw,"\n")|stats count by rows|table rows