Splunk 生成只有一行的 table

Splunk produces a table with only one row

我正在使用 splunk 仪表板将键值日志文件解析为 table。

这是我正在使用的搜索:

...
<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>

然而,虽然日志文件中有很多行可以满足此搜索,但我的仪表板只给我一个 table,只有一行。我想要一个 table,每一行都有行,就像日志中那样。

我做错了什么?

更新:

事实证明,splunk 将整个 .log 文件视为一个事件。文件中的所有行一起查看,而不是单独查看。

有关将日志文件上传到 splunk 或有关 splunk 解释日志文件的问题。 (我说过该文件应该被视为 sourcetype = log2metrics_keyvalue )

请帮忙

也许您可以尝试使用正确的分隔符进行类似的操作: |eval rows=split(_raw,"\n")|stats count by rows|table rows

听起来您的日志文件并不是真正的来源类型 log2metrics_keyvalue。使用与您的数据匹配的换行设置创建您自己的 props.conf 文件节。