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!

Good Sourcetype Naming

When it comes to getting data in, one of the earliest decisions made is what to use as a sourcetype. Often, ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Splunk App for Anomaly Detection End of Life Announcement

Q: What is happening to the Splunk App for Anomaly Detection?A: Splunk is officially announcing the ...