How can I edit my query to exclude partially matched results in the aggregate view?

Comments

5 comments

  • Official comment
    Avatar
    Ryan Johnson

    Hi admin.amartin :-)

    The good news is that you were very close!

    The equals (=) operator evaluates for a literal match. To do partial matches, use the matches operator (LINK) which will allow asterisked wildcards or regular expressions (which by the looks of things you're more than comfortable with :-)

    The only other suggestion I'd make would be to optimise your initial parse regex to speed up processing based on the desired outcome.

    | parse regex " (?<name>\S*?)\s(?<msg_type>urls)\s+"

    Using a literal match for "urls" will provide the desired filtering, and removing nodrop will reduce unnecessary processing by dropping fields you're not ultimately interested in anyway (based on your where statement towards the end of the query).

    I hope this helps!

    RJ

    Comment actions Permalink
  • Avatar
    Ryan Johnson

    Ahh, I realise I didn't actually give you a workable answer!

    | where msg_type="urls" AND !(url matches "https://dev-prod05.conferdeploy.net/*")

    Please feel free to keep asking questions in here, or even over in our public Slack channel (LINK)

    Cheers :-)

    RJ

    1
    Comment actions Permalink
  • Avatar
    admin.amartin

    Oh I absolutely did not mean to mislead you or anyone else reading this post.

    This saved search was based on a pre-built Meraki panel. I am nowhere near the comfort level to be writing like this just yet but I am working on it! I'm only now getting comfortable with parse anchors so I've just been trying to reverse engineer the dashboard panel searches to fit my needs. I can only hope to someday write these queries from scratch myself. 

    So, given your reply I'm still not quite sure what I need to modify to exclude some of the URLs I'm seeing. How would I write this into the search query if I wanted to exclude the first three URLs I'm seeing or other results that include "office365"? These are known URLs that we expect to see users accessing so I don't need to see them in this saved search/e-mail notification.

    With enough time and the training provided I'm determined to get there! 

    Thanks much for your reply!

    0
    Comment actions Permalink
  • Avatar
    admin.amartin

    Thanks, Ryan! I'm in the Slack channel as well! Hopefully I'm posting in the right channel but if I'm not, please do let me know. I posted this same question there.

    Quick edit to my post here -- is there any way to have it exclude the result in the aggregate window based on a partial match or does it have to be exact?

    In the answer you provided you have the full link but I'm hoping to exclude a result based on only part of the url. Not sure if this is possible.

    Ninja edit: I ended up using "contains" instead of "matches" so I think that's working now.

    I appreciate the assist!

    0
    Comment actions Permalink
  • Avatar
    Ryan Johnson

    For those browsing in future, this is where we landed :-)

    [...]
    | where msg_type="urls"
    | where !(
    url contains "apple" OR
    url contains "banana" OR
    url contains "carrot"
    )
    0
    Comment actions Permalink

Please sign in to leave a comment.