如何从Splunk表中删除空行?

huangapple go评论65阅读模式
英文:

How to remove empty rows from Splunk table?

问题

在我的查询响应中,有时我得不到数据,只会添加一个空行。我想删除空行,是因为我的正则表达式没有找到任何记录。

index=stg host="stg-host1" " Number of data processed for day is"
| rex "(?<Records>[^\s]+) from file"
| timechart max(Records) as TotalRecords 
span=45min

预期结果:删除所有空行。只有在TotalRecords具有某个值时才应可用。

当前表格:

如何从Splunk表中删除空行?

英文:

In my query response, few time I don't get data and it's just adding row empty row.
I like to remove empty row it's my regex not found any records.

index=stg host=&quot;stg-host1&quot; &quot; Number of data processed for day is&quot;
| rex &quot;(?&lt;Records&gt;[^\s]+) from file&quot;
| timechart max(Records) as TotalRecords 
span=45min

Expected: Remove all empty rows. Row should only available if TotalRecords has some value.

Current Table:
如何从Splunk表中删除空行?

答案1

得分: 2

你可以使用以下命令来移除包含特定字段为空值的结果,例如TotalRecords字段:

| where isnotnull(TotalRecords)
英文:

You can use the following command to remove results that contain a specific field with a null value, in this case TotalRecords:

| where isnotnull(TotalRecords)

huangapple
  • 本文由 发表于 2023年3月7日 03:40:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/75655146.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定