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!

Splunk APM & RUM | Upcoming Planned Maintenance

There will be planned maintenance of Splunk APM’s and Splunk RUM’s streaming infrastructure in the coming ...

Part 2: Diving Deeper With AIOps

Getting the Most Out of Event Correlation and Alert Storm Detection in Splunk IT Service Intelligence   Watch ...

User Groups | Upcoming Events!

If by chance you weren't already aware, the Splunk Community is host to numerous User Groups, organized ...