Splunk Search

how to show multiple columns in table along with timestamp

rkishoreqa
Communicator

Hi team,

 

I have one requirement to prepare a query to get a value from json and do chart count around it. For this I have added multiple chart count queries using appendcols, but it is very slow.  Also I need the timestamp. 

log is like as below: 

Success: 1
failed: 2
Total: 3

index=<<>> |search app="app1" |rex "Total: (?<TCount>[^\"]*)" |eval TCount=rtrim(TCount,"\\") |chart count(TCount) over TCount |appendcols [search |rex "Success: (?<S_Count>[^\"]*)"|eval S_Count=rtrim(S_Count,"\\") |chart count(S_Count) over S_Count]
|appendcols [search |rex "failed: (?<FCount>[^\"]*)"|eval F_Count=rtrim(FCount,"\\") |chart count(FCount) over FCount]

Can anyone help me on this to make it run faster. 

 

Thanks in Advance.

 

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Appendcols is almost always the wrong command.  I probably should do a B-Side talk on it, but for now just forget you ever heard of appendcols.

As for what you should do, well that depends on what you want the output to be.  Please share.

---
If this reply helps you, Karma would be appreciated.
0 Karma

rkishoreqa
Communicator

@richgalloway  I want the output as below. 

Value   SuccessCount          value    FailedCount           value       TotalCount
  1                  1                                 2               1                             3                      1

0 Karma

richgalloway
SplunkTrust
SplunkTrust

This would be the rare case where appendcols is actually useful.

None of the alternatives I've tried work so it's a matter of making what you have work faster.  Use the usual methods for doing that: filter as much as and as soon as possible; reduce the time range as much as possible; make sure the data is well balanced among your indexers.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...