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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Self-Healing Pipeline Is Now Generally Available: AI-Powered CIM Compliance

Maintaining data integrity across security and analytics pipelines is an ongoing challenge. Data ...

[Puzzles] Solve, Learn, Repeat: Family Trees

This puzzle (first published here is based on finding grandparents and grandchildren (inspired by a question ...