Splunk Search

Field extraction based on position of character

mbasharat
Builder

Hi,

I have field that gives me NETBOS of a Host.

Sample Host Name: 123456W12345678

The 7th character makes the identification for whether it is server or not a server.

How to extract this 7th character into a new field "Classification"? Result using above example should be:
field name=Classification
field value=W

Thanks in advance!!!

Tags (1)
0 Karma
1 Solution

mayurr98
Super Champion

try this :

| makeresults | eval host="123456412345678" | rex field=host "(\d{6}|\w{6})?(?<Classification>\w{1})"

View solution in original post

0 Karma

mayurr98
Super Champion

try this :

| makeresults | eval host="123456412345678" | rex field=host "(\d{6}|\w{6})?(?<Classification>\w{1})"
0 Karma

mbasharat
Builder

Worked. THANKS!!!

0 Karma
Get Updates on the Splunk Community!

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...

Splunk App Dev Community Updates – What’s New and What’s Next

Welcome to your go-to roundup of everything happening in the Splunk App Dev Community! Whether you're building ...

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco &#43; Splunk! We’ve ...