Splunk Search

How to split the value into title and value?

mcohen13
Loves-to-Learn

I have a field that I extract to information from Whois
this field every value is write so that the title of the value is before ":" char and the title value is after ":" char
for example:
Updated Date: 2018-05-18T07:59:22Z
Creation Date: 2018-05-13T07:59:22Z

What I want to do is to split this value in the field to a title field to hold the left side of the first ":" and the value of the title in the right side of the ":" char
I need this to apply only to the first ":" char because some value get have more than one ":" char as you can see above

0 Karma
1 Solution

harishalipaka
Motivator

hi @mcohen

|makeresults |eval custid="Updated Date: 2018-05-18T07:59:22Z" | rex field=custid "(?<subField1>[^:]+):(?<subField2>.+)"
Thanks
Harish

View solution in original post

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi @mcohen13,

Can you please try the following search? I have used rex command for extracting first and second value. See column A & B for first and second value respectively.

| makeresults | eval data="Updated Date: 2018-05-18T07:59:22Z,Creation Date: 2018-05-13T07:59:22Z", data=split(data,",") | mvexpand data | rex field=data "(?<A>.*):\s(?<B>.*)" | table data A B

Thanks

0 Karma

harishalipaka
Motivator

hi @mcohen

|makeresults |eval custid="Updated Date: 2018-05-18T07:59:22Z" | rex field=custid "(?<subField1>[^:]+):(?<subField2>.+)"
Thanks
Harish
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...