====== Splunk ====== ===== Install ===== ==== Server (Host Name:splunkserver) ==== On the server download rpm file and run rpm -ivh splunk-6.2.2-255606-linux-2.6-x86_64.rpm * Default user/password is: admin/changeme * Default HTTP port is: 8000 * Default Home: /opt/splunk Full start-up log # /opt/splunk/bin/splunk start Splunk> Finding your faults, just like mom. Checking prerequisites... Checking http port [8000]: open Checking mgmt port [8089]: open Checking appserver port [127.0.0.1:8065]: open Checking kvstore port [8191]: open Checking configuration... Done. Checking critical directories... Done Checking indexes... Validated: _audit _blocksignature _internal _introspection _thefishbucket history main summary Done Checking filesystem compatibility... Done Checking conf files for problems... Done All preliminary checks passed. Starting splunk server daemon (splunkd)... Done [ OK ] Waiting for web server at http://127.0.0.1:8000 to be available... Done If you get stuck, we're here to help. Look for answers here: http://docs.splunk.com The Splunk web interface is at http://splunkserver:8000 ==== Agent (Host Name:splunkclient) ==== On the client download rpm file and run rpm -ivh splunkforwarder-6.2.2-255606-linux-2.6-x86_64.rpm ===== Configuration ===== ==== Server ==== === Define Listen Port === On the web console: Setting -> Forwarding and Receiving -> Add Receiving -> Define listen Port (9997) === New Index === Create new index rts on splunk enterprise web === New Source Type === In this example we are creating a new source type for haproxy as that is not available by default for splunk. Steps * Copy /opt/splunk/etc/system/local/props.conf from /opt/splunk/etc/system/default/props.conf * Created a new sourccetype block for haproxylog [haproxylog] category = Web pulldown_type = true EXTRACT-haproxy_httplog = haproxy\b.*? (?\d+\.\d+\.\d+\.\d+):(?\d+) \[[^\]]+\] (?\S+) (?[^/]+)/(?\S+) (?\d+)/(?\d+)/(?\d+)/(?\d+)/(?\d+) (?\d+) (?\d+) \S+ \S+ (?\S{4}) (?\d+)/(?\d+)/(?\d+)/(?\d+)/(?\d+) (?\d+)/(?\d+)(?: \{(?[^\}]*)\})?(?: \{(?[^\}]*)\})? "(?\S+)\s+(?[^"]+?)(?: HTTP\S+)?" NO_BINARY_CHECK = true SHOULD_LINEMERGE = false description = HAProxy single line log disabled = false === Other settings === Changed minimum disk free space required to 2GB from 5GB. ==== Client ==== === Configure to monitor haproxy.log === Add forward server as the splunkserver on the designated port /opt/splunkforwarder/bin/splunk add forward-server splunkserver:9997 -auth admin:changeme == Log forwarding == Modify /opt/splunkforwarder/etc/system/local/inputs.conf and add a monitor stanza to monitor haproxy.log, specified sourcetype and index [default] host = splunkclient [monitor:///var/log/haproxy.log] sourcetype = haproxylog index = rts Modify /opt/splunkforwarder/etc/system/local/outputs.conf to add forwarding [tcpout] defaultGroup = default-autolb-group [tcpout:default-autolb-group] server = splunkserver:9997 [tcpout-server://splunkserver:9997] === Restart forwarder === /opt/splunkforwarder/bin/splunk restart