Splunk Search

How do you search logs for a letter at a specific position?

arthurva
Explorer

I'm very new to Splunk and need help with a search.

I want to perform a search to show me the results where the 5th letter of the server name has the letter "p". Is this possible?

Thank you

0 Karma
1 Solution

Vijeta
Influencer

@arthurva Suppose your index is test and your field is server_name.

index=test| eval x = substr(server_name,5,1)| where x="p"

View solution in original post

0 Karma

vnravikumar
Champion

Hi @arthurva

Give a try

| makeresults 
| eval test="ABCDPTD" 
| regex test="^.{4,4}[p|P]"
0 Karma

Vijeta
Influencer

@arthurva Suppose your index is test and your field is server_name.

index=test| eval x = substr(server_name,5,1)| where x="p"
0 Karma

arthurva
Explorer

That worked. Thank you!

0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud's AI Assistant in Action Series: Auditing Compliance and ...

This is the third post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...