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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...