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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...