我正在使用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)
请帮助。