Dashboards & Visualizations

How to trim Splunk logs to get time and particular field?

kkanand
Explorer

Hello

I am having the following query: 

index=*  "There was an error trying to process" | table _raw

logs

_raw

1 2022-10-25 22:10:59.937 ERROR 1 --- [rTaskExecutor-1] c.s.s.service.InboundProcessingFlow : There was an error trying to process PPositivePay121140399F102520220942.20221025094304862.ach from Inbox.
2 2022-10-25 22:10:57.824 ERROR 1 --- [rTaskExecutor-1] c.s.s.service.InboundProcessingFlow : There was an error trying to process FPositivePay121140399Q102420222215.20221024221617018.ach from Inbox.
3 2022-10-25 22:10:57.824 ERROR 1 --- [rTaskExecutor-2] c.s.s.service.InboundProcessingFlow : There was an error trying to process FPositivePay121140399W102520220113.20221025011346442.ach from Inbox.
4 2022-10-25 22:11:53.729 ERROR 1 --- [rTaskExecutor-2] c.s.s.service.InboundProcessingFlow : There was an error trying to process PPositivePay121140399Q102420222215.20221024221617018.ach from Inbox.



I would need to alter the search query so that the output is becoming: 

Time                             file_name

2022-10-25 15:10:49 PPositivePay121140399F102520220942.20221025094304862.ach
2022-10-25 15:10:59 FPositivePay121140399Q102420222215.20221024221617018.ach
2022-10-25 15:11:09 FPositivePay121140399W102520220113.20221025011346442.ach
2022-10-25 15:11:14 PPositivePay121140399Q102420222215.20221024221617018.ach

 

Thanks

@gcusello 

Labels (1)
0 Karma

kkanand
Explorer

kkanand_0-1666790745673.png

I dont want the "from inbox" to show up in the field
Just

_time message

2022-10-25 22:11:00.015PPositivePay121140399F102520220942.20221025094304862.ach
2022-10-25 22:10:57.826FPositivePay121140399Q102420222215.20221024221617018.ach
2022-10-25 22:10:57.826FPositivePay121140399W102520220113.20221025011346442.ach
2022-10-25 22:11:53.729PPositivePay121140399Q102420222215.20221024221617018.ach
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @kkanand,

you have to add _time to your table command

index=*  "There was an error trying to process" 
| table _time _raw

Ciao.

Giuseppe

0 Karma

kkanand
Explorer

Dashboard

kkanand_0-1666764478476.png

I want it like this

kkanand_1-1666764583139.png

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

HI @kkanand,

sorry, but the _raw of the two screenshots are different: you don't want _raw, but a part of it.

in this case yu have to extract a part of _raw using a regex, in this case you can try something like this:

index=*  "There was an error trying to process" 
| rex "There was an error trying to process (?<message>.*)"
| table _time message

Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...