Splunk Search

How to search for events that doesn't contain "-" in the url request

jkirankumar1993
New Member

Hi i want to retrieve events that does not have "-" in the request url.

index=con_jira [| gentimes start=-1 | eval source="/opt/atlassian/current/logs/access_log." + strftime(now(), "%F")  | return source] "GET /browse" | eval headers=split(_raw," ") | eval method=mvindex(headers,5) |eval request=mvindex(headers,6) | where request!="*-" | table request

sample Result:
/browse/EPS -----> correct result
/browse/ISPTEXAS-27534 ----> wrong result

Tags (1)
0 Karma

mayurr98
Super Champion

hey try this run anywhere search

| makeresults 
| eval request="/browse/EPS /browse/ISPTEXAS-27534 /browse/fsfsf-27534 /browse/abc /browse/edg /browse/abc-def" 
| makemv request 
| mvexpand request 
| where NOT like(request,"%-%")

In your environment, you should write

index=con_jira 
    [| gentimes start=-1 
    | eval source="/opt/atlassian/current/logs/access_log." + strftime(now(), "%F") 
    | return source] "GET /browse" 
| eval headers=split(_raw," ") 
| eval method=mvindex(headers,5) 
| eval request=mvindex(headers,6) 
| table request 
| where NOT like(request,"%-%")

let me know if this helps!

0 Karma

worshamn
Contributor

Probably several ways to skin this cat. You could try modifying where clause to:

|where NOT request LIKE "%-%"

Or just use search:

|search NOT request="*-*"

Or use the regex command:

|regex request!=".*-.*"
0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...