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!

Demo Day: Strengthen Your SOC with Splunk Enterprise Security 8.1

Today’s threat landscape is more complex than ever. Security operation centers (SOCs) are overwhelmed with ...

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

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