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!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...