Splunk Dev

how to extract a particular field value and display in table with different column name

mrr6892
Loves-to-Learn

I got a requirement to extract " response_time: " field value from all logs and display table with name cf_rt I tried creating new field but its not returning data from all matching case. please advise.

Log format:

response_time:0.091901 gorouter_time:0.000400 app_id:"038e332a-4423-426b-9693-2488eafcd37d"
alt text

Tags (1)
0 Karma

vnravikumar
Champion

Hi

Give a try with this rex

| makeresults 
| eval _raw="x_forwarded_proto:\"https\" vcap_request_id:\"2978162c-8dcc-47cb-ad10- e73187c36896\" response_time:1.833375 gorouter_time:0.000280 app_id:\"fd22e808-539c-4003-b221-cdc42aa03dbb\" app_index:\"0\" x_b3_traceid:\"12474aa9e6d47857\" x_b3_spanid:\"d3745ed0d25bd8d3\" x_b3_parentspanid:\"12474aa9e6d47857\" b3:\"12474aa9e6d47857- d3745ed0d25bd8d3-1-12474aa9e6d47857\" " 
| rex "response_time:(?P<response_time>\S+)"
0 Karma

mrr6892
Loves-to-Learn

alt text

0 Karma

mrr6892
Loves-to-Learn

how can we display yellow highlighted key value in table

alt text

0 Karma

to4kawa
Ultra Champion
your search
| raname msg as _raw
| extract pairdelim=" " kvdelim=":"
| rename response_time as cf_rt
0 Karma

mrr6892
Loves-to-Learn

how can we display yellow highlighted key value from all events in to table

0 Karma

to4kawa
Ultra Champion

I see, my answer is updated.

0 Karma

mrr6892
Loves-to-Learn

thanks i am able to pull the data but not able to rename the _raw column it should be renamed as msg when i did that my response time values are not showing in table.

0 Karma

to4kawa
Ultra Champion

I'm not sure, please use a regular expression.

0 Karma
Get Updates on the Splunk Community!

What the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...