Splunk Search

output of time field in splunk

avi123
Explorer

Hi All,

I have time field having time range in this format in output of one splunk query:

TeamWorkTimings

09:00:00-18:00:00

I want to have the values stored in two fields like:

TeamStart

09:00:00

TeamEnd

18:00:00

How do I achieve this using regex or concat expression in splunk. Please suggest.

Labels (1)
0 Karma

avi123
Explorer

thanks, it worked 🙂 

One more request, since I am new to splunk, could you please help me understand how this regular expression works, I mean what does this means in a regex expression:

| rex field=TeamWorkTimings "(?<TeamStart>[^-]+)-(?<TeamEnd>.*)"

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

regex101.com is a good site to test and understand regular expressions

I have set this one up to show your extraction

https://regex101.com/r/mBRfJF/1

 

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| rex field=TeamWorkTimings "(?<TeamStart>[^-]+)-(?<TeamEnd>.*)"
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...