Splunk Hack #4 - Aliasing Splunk with a Subdomain

With the new release of Splunk Preview out, I’ve run into a problem keeping the different versions straight on my laptop. I have the free version, the Preview, the official release, and a version of current running - often times simultaneously. It’s getting messy.

What you really want to do is refer to them with different subdomain names, where something like http://splunkpreview.mydomain.com/ would bring up Splunk without having to remember the port number.

If you are running Apache, (like I am on Leopard) you get a reverse proxy server for free. With just a few lines of configuration, you can alias subdomains (or domains for that matter) to your heart’s content.

You also get the ability of putting content behind some basic authentication provided via Apache’s HTTP auth methods. This comes in handy if you’d like to link to your Splunk install from a publicly facing page, but don’t want people to know what type of content is behind the authentication. It also works for limiting access to a particular IP address group or domain.

I’ve put together a screencast covering how to do this from OS X’s version of Apache. Click on the thumbnail below to play the screencast.

Note: Firewalling the actual port Splunk runs on is left as an exercise for the viewer, as is limiting access to a group of IP addresses. More information about configuring Apache’s mod_proxy module can be found on Apache’s website.

Here’s the configuration code from the screencast:

  1. <VirtualHost *:80>
  2.     ServerName preview.geekceo.com
  3.     <Location />
  4.         ProxyPass http://localhost:8000/
  5.         ProxyPassReverse http://localhost:8000/
  6.     </Location>
  7. </VirtualHost>
  8.  
  9. <VirtualHost *:80>
  10.     ServerName free.geekceo.com
  11.     <Location />
  12.         ProxyPass http://localhost:8001/
  13.         ProxyPassReverse http://localhost:8001/
  14.         AuthType Basic
  15.         AuthName "Password Required"
  16.         AuthUserFile /etc/.htpasswd
  17.         require valid-user
  18.     </Location>
  19. </VirtualHost>

2 Responses to “Splunk Hack #4 - Aliasing Splunk with a Subdomain”

  1. Michael Wilde Says:

    Sweet!

  2. Splunk Dev » Blog Archive » Gem Noticed by Enterprise Networking Planet Says:

    [...] he actually spends quite a bit of time explaining the security workaround in the free product - one that I covered earlier in the week, coincidently enough. I figure if someone goes to the time and trouble to [...]

Leave a Reply