Splunk Search

Search For CamelCase

peasead
Path Finder

Occassionally we see DNS requests that come in using CamelCase (coMpanY.com or COMpaNy.com, etc.) instead of company.com or COMPANY.COM.

Is there a way to search for logs that have CamelCase?

Tags (2)
0 Karma
1 Solution

okrabbe_splunk
Splunk Employee
Splunk Employee

Interesting question. One option you could try to take is come up with a regex that meets your definition of CamelCase.

I stole this one from a Stack Overflow question:
http://stackoverflow.com/questions/10182664/check-for-camel-case-in-python

You could then match the field using regex:
mysearch | regex domain="(?:[A-Z])(?:\S?)+(?:[A-Z])(?:[a-z])+

This should filter out any results that do not match the regular expression for the domain field. You could also do it on raw if you like.

The other option, which may be easier/more reliable depending on your inclination, would be to write a custom search command in python. There is even an example in the link I gave before.

View solution in original post

okrabbe_splunk
Splunk Employee
Splunk Employee

Interesting question. One option you could try to take is come up with a regex that meets your definition of CamelCase.

I stole this one from a Stack Overflow question:
http://stackoverflow.com/questions/10182664/check-for-camel-case-in-python

You could then match the field using regex:
mysearch | regex domain="(?:[A-Z])(?:\S?)+(?:[A-Z])(?:[a-z])+

This should filter out any results that do not match the regular expression for the domain field. You could also do it on raw if you like.

The other option, which may be easier/more reliable depending on your inclination, would be to write a custom search command in python. There is even an example in the link I gave before.

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 ...