Splunk Search

Why my timechart is giving an additional column called "VALUE" ?

sivagujju
New Member

I am using the below query to create a timechart.

sourcetype=xxx AND source = "xxxx"  | rex "Operation:(?[A-Z]*)"  | rex "\[Tx.*\]:\[(?.*)\]:" | transaction  TransactionId | timechart avg(duration) by Operation

There are only two possible values for Operation: GetToken, SetToken

But in the result, I am seeing 3 columns ( 3 lines in the timechart)
GetToken
SetToken
VALUE (average of GetToken, SetToken for each row)

Why does this VALUE column comes in ? It didnt happen in other queries. What am I doing wrong ?

Tags (3)
0 Karma
1 Solution

chanfoli
Builder

I am not sure what the second rex is doing here but the usual splunk syntax for field extraction contains a FIELDNAME as follows:

 sourcetype=xxx AND source = "xxxx"  | rex "Operation:(?<Operation>[A-Z]*)"  | rex "\[Tx.*\]:\[(?<someotherfieldname>.*)\]:" | transaction  TransactionId | timechart avg(duration) by Operation

Perhaps I am just unfamiliar with your extraction syntax.

View solution in original post

chanfoli
Builder

I am not sure what the second rex is doing here but the usual splunk syntax for field extraction contains a FIELDNAME as follows:

 sourcetype=xxx AND source = "xxxx"  | rex "Operation:(?<Operation>[A-Z]*)"  | rex "\[Tx.*\]:\[(?<someotherfieldname>.*)\]:" | transaction  TransactionId | timechart avg(duration) by Operation

Perhaps I am just unfamiliar with your extraction syntax.

sivagujju
New Member

Yeah. I pasted the query wrongly. Second one is the Transaction Id. This is to group the events.

sourcetype=xxx AND source = "xxxx" | rex "Operation:(?[A-Z])" | rex "[Tx.]:[(?.*)]:" | transaction TransactionId | timechart avg(duration) by Operation

0 Karma

chanfoli
Builder

Have you looked at your results after each step in your search pipeline to verify that both extractions and the transaction command are working as expected?

0 Karma

sivagujju
New Member

Yeah. In fact there are not many steps.
What I am trying to achieve is, a time chart on average(duration) for each operation. In the end result, I get 3 lines in the chart.
1. GetToken
2. SetToken
3. VALUE ( Where does this come from ??)

0 Karma

chanfoli
Builder

Yes, understood, to me it sounds like your Operation extraction rex is getting an unexpected value. Do you only see two values for that field if you remove the timechart command.

0 Karma

sivagujju
New Member

Sorry for the late reply. You were right.. Thanks.

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...