Splunk Search

How to extract the nth letter from these sample host names using regular expression?

imthesplunker
Path Finder

How to extract the nth letter from the host using regular expression?

Sample hosts are :-
host=abcdefpghijkl11 (prod )
host=abcdefsghijkl12 (stg)
host=abcdefdghijkl13 (dev)

0 Karma
1 Solution

somesoni2
Revered Legend

Try like this. e.g. if you want to extract 10th character,

your base search | eval mychar=substr(host,10,1)

Alternatively,

your base search | rex field=host "^\w{9)(?<mychar>\w)"

View solution in original post

0 Karma

somesoni2
Revered Legend

Try like this. e.g. if you want to extract 10th character,

your base search | eval mychar=substr(host,10,1)

Alternatively,

your base search | rex field=host "^\w{9)(?<mychar>\w)"
0 Karma

imthesplunker
Path Finder

Thanks !...

0 Karma
Get Updates on the Splunk Community!

What's New in Splunk Cloud Platform 9.3.2411?

Hey Splunky People! We are excited to share the latest updates in Splunk Cloud Platform 9.3.2411. This release ...

Buttercup Games: Further Dashboarding Techniques (Part 6)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...