11.07.2015 Views

Setting up Splunk for VMware Monitoring - VMware Communities

Setting up Splunk for VMware Monitoring - VMware Communities

Setting up Splunk for VMware Monitoring - VMware Communities

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2009<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Proven Practice GuideA how-to guide <strong>for</strong> monitoring <strong>VMware</strong> ESX, ESXi and vCenter Servers andWindows and Linux Virtual Machines using <strong>Splunk</strong> Server.David Converywww.DailyHypervisor.com6/30/2009


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Table of ContentsSummary ....................................................................................................................................................... 3Requirements ................................................................................................................................................ 3Preparing the <strong>Splunk</strong> Server ......................................................................................................................... 3Installing <strong>Splunk</strong> Server ................................................................................................................................. 4<strong>Setting</strong> <strong>up</strong> ESX Servers and Linux VMs <strong>for</strong> <strong>Monitoring</strong> ................................................................................. 7<strong>Setting</strong> <strong>up</strong> ESXi Servers <strong>for</strong> <strong>Monitoring</strong> ......................................................................................................... 9<strong>Setting</strong> <strong>up</strong> vCenter Servers and Windows VMs <strong>for</strong> <strong>Monitoring</strong> .................................................................. 10<strong>Setting</strong> <strong>up</strong> SNARE .................................................................................................................................... 10<strong>Setting</strong> <strong>up</strong> Epilog ..................................................................................................................................... 13Confirming a System is Monitored ......................................................................................................... 17Adding Miscellaneous Log Files to <strong>Splunk</strong> <strong>for</strong> Troubleshooting ................................................................. 18David Convery Pg 2 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>SummaryGathering and maintaining log files is an important part of a server administrator’s duties. Using acentralized logging server, such as a sylog server offers several benefits. The log files become useful <strong>for</strong>troubleshooting purposes, if needed. Also, keeping an unaltered set of logs in a different location can aidin <strong>for</strong>ensic activities after an attack.This document explains how to set <strong>up</strong> <strong>Splunk</strong> <strong>for</strong> monitoring a <strong>VMware</strong> Environment. This includesmonitoring the ESX/ESXi Server logs, the vCenter Server Logs and some of the add-on services tovCenter. It also includes generic event logging <strong>for</strong> Windows and Linux guest operating systems.RequirementsThe <strong>Splunk</strong> Server can be downloaded from the web site - http://www.splunk.com/ . For this document,we will be using the Linux version on an Ubuntu server VM. Refer to the documentation <strong>for</strong> systemrequirements, but current recommendation call <strong>for</strong> a dual processor system with 4GB RAM. There areversions of <strong>Splunk</strong> available <strong>for</strong> several operating systems, including Windows. I chose Ubuntu <strong>for</strong> thisdocument because it is free and easy to install.Windows Event Logs will be monitored using SNARE. Windows text based log files will be monitoredusing Epilog. Both of these agents can be downloaded from http://source<strong>for</strong>ge.net/projects/snare/ .Preparing the <strong>Splunk</strong> ServerCreate a VM with 2 vCPUs and 4GB vRAM. Install Ubuntu server, choose the OpenSSH package duringthe installation if you wish to per<strong>for</strong>m remote administration. No other packages are required. Once theinstallation is complete, <strong>up</strong>date your system by running sudo apt-get <strong>up</strong>date and then sudo apt-get<strong>up</strong>grade. For more in<strong>for</strong>mation, refer to the official server guide at:https://help.ubuntu.com/9.04/serverguide/C/index.html orhttps://help.ubuntu.com/9.04/serverguide/C/serverguide.pdfAfter the system is <strong>up</strong>dated, install <strong>VMware</strong> Tools following this guide:https://help.ubuntu.com/community/<strong>VMware</strong>/ToolsDownload the latest copy of <strong>Splunk</strong> Server from the <strong>Splunk</strong> web site and copy it to the /tmp directory onthe Ubuntu server using SCP.David Convery Pg 3 of 18 www.dailyhypervisor.com


Installing <strong>Splunk</strong> Server<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Copy the latest installation package tothe /tmp directory using SCP.Use the dpkg utility to install thepackage:sudo dpkg –I splunk-3.x.x-xxxxx-linux-2.6-amd64.debEnter your password.David Convery Pg 4 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Note the installation path and the url <strong>for</strong>your new <strong>Splunk</strong> Server:$SPLUNK_HOME = /opt/splunkhttp://<strong>Splunk</strong>ServerFQDN:8000Start the <strong>Splunk</strong> Server and accept thelicense:sudo /opt/splunk/bin/splunk start --accept-licenseConfirm the <strong>Splunk</strong> Server has started.David Convery Pg 5 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Enable the <strong>Splunk</strong> Server to start on boot:sudo /opt/splunk/bin/splunk enable bootstartConfirm that auto start is enabled.CONGRATULATIONS! You have installed your <strong>Splunk</strong> Server. Easy huh?David Convery Pg 6 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong><strong>Setting</strong> <strong>up</strong> ESX Servers and Linux VMs <strong>for</strong> <strong>Monitoring</strong><strong>Setting</strong> <strong>up</strong> an ESX or a Linux Server <strong>for</strong> monitoring requires you to edit the /etc/syslog.conf configurationfile. In this example, we will use vi, but nano can be used as well.Login to the console as root (or use sudo)and begin to edit the /etc/syslog.conf file:vi /etc/syslog.conf-ORsudovi /etc/syslog.confGo to the end of the file by entering:GAPPEND the line by entering:aAdd a line to point to the <strong>Splunk</strong> Syslogserver:# send all to syslog server*.* @192.168.23.140(Substitute the IP address <strong>for</strong> your <strong>Splunk</strong>Server)David Convery Pg 7 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>WRITE and QUIT by entering::wqRestart the syslog service, enter:/etc/init.d/syslog restartThe syslog service will restartDavid Convery Pg 8 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>(ESX Only) Configure and restart thefirewall:esxcfg-firewall –o 514,udp,out,syslogesxcfg-firewall –l<strong>Setting</strong> <strong>up</strong> ESXi Servers <strong>for</strong> <strong>Monitoring</strong><strong>Setting</strong> <strong>up</strong> ESXi servers requires connection using the VI Client, either directly to the ESXi Server orthrough the vCenter Server. As an alternative, you can use the vCLI or PowerCLI <strong>for</strong> this task.Open the VI Client and select the ESXiserver. Click on the Configuration taband then on the Advanced link. Browseto Syslog > Remote and enter the IPaddress and port <strong>for</strong> the <strong>Splunk</strong> Server.David Convery Pg 9 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong><strong>Setting</strong> <strong>up</strong> vCenter Servers and Windows VMs <strong>for</strong> <strong>Monitoring</strong><strong>Monitoring</strong> a vCenter Server, a <strong>VMware</strong> Update Manager Server and any Windows based physical orvirtual machine will require agents to parse the logs and send them to the syslog server. We will useSNARE and Epilog <strong>for</strong> this purpose. These agents can be downloaded fromhttp://source<strong>for</strong>ge.net/projects/snare/ .<strong>Setting</strong> <strong>up</strong> SNARESNARE will be used to monitor the Windows Event Logs. It will convert them and send to the syslogserver.Download the SNARE installer package <strong>for</strong> yourversion of Windows. Use the Vista package <strong>for</strong>Windows 2008.For remote control, select:Yes – with password, local access onlyDavid Convery Pg 10 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Open a browser and go to:http://localhost:6161Login credentials are snare / snareClick on the Network Configuration link in theleft pane.Enter the IP address and port of the <strong>Splunk</strong>Server.Enable SYSLOG HeaderSet SYSLOG Facility to SyslogSet SYSLOG Priority to DYNAMICDavid Convery Pg 11 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Click on the Remote Control Configuration linkin the left pane.Enter a secure passwordEdit the Filtering Objectives Configuration asnecessary by clicking Modify.Edit as needed.David Convery Pg 12 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>After a few minutes, click on the Latest Eventslink in the left pane and verify that the EventLog is being monitored.<strong>Setting</strong> <strong>up</strong> EpilogEpilog will be used to monitor all of the text based log files associated with the vSpere services and anyother services that you wish to monitor.Check out http://viops.vmware.com/home/community/management/logging <strong>for</strong> some good loggingin<strong>for</strong>mation. Check http://kb.vmware.com/kb/1010956 <strong>for</strong> the VMO logs.Download the Epilog installer package <strong>for</strong> yourversion of Windows. Use the Vista package <strong>for</strong>Windows 2008.David Convery Pg 13 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Open a browser and go to:http://localhost:6162Login with snare / snareClick on the Log Configuration link in the leftpane.Click on the Add button.Enter the path and log name <strong>for</strong>mat <strong>for</strong> the logfile you wish to monitor and click ChangeConfiguration.David Convery Pg 14 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Repeat <strong>for</strong> each additional log file.Click on the Network Configuration link in theleft pane, edit the settings and click ChangeConfiguration.Click on the Remote Control Configuration linkin the left pane, reset the snare password andclick Change Configuration.David Convery Pg 15 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Click on the Objectives Configuration link in theleft pane. Click on the Add button.Enter * and click Change Configuration.When finished, click on the Apply the LatestAudit Configuration link in the left pane.Click on the Latest Events link in the left paneto monitor the logs.David Convery Pg 16 of 18 www.dailyhypervisor.com


Confirming a System is Monitored<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>At the <strong>Splunk</strong> console, type the followingto check that a server is being monitored:/opt/splunk/bin/splunk list udpThis will return a list of UDP ports beingmonitored and the systems beingmonitored.David Convery Pg 17 of 18 www.dailyhypervisor.com


<strong>Setting</strong> <strong>up</strong> <strong>Splunk</strong> <strong>for</strong><strong>VMware</strong> <strong>Monitoring</strong>Adding Miscellaneous Log Files to <strong>Splunk</strong> <strong>for</strong> TroubleshootingSometimes, it may be necessary to add log files from an unmonitored or isolated source to aid introubleshooting. The steps listed below demonstrate how to do this.Add a directory <strong>for</strong> your log files:sudo mkdir /var/<strong>Splunk</strong>MonitorSet the proper permissions:sudo chmod 755 /var/<strong>Splunk</strong>MonitorIn this case, I am copying a VizionCore vConverterlog bundle to the directory.Unzip the log bundle if required.Add the directory within <strong>Splunk</strong>:/opt/splunk/bin/splunk add monitor /var/<strong>Splunk</strong>Monitor<strong>Splunk</strong> will return that the directory is beingmonitored. Any text based files placed in thisdirectory will be automatically scanned.For a good article about how to collect diagnostic data from all of the <strong>VMware</strong> products, check out thisarticle -> http://kb.vmware.com/kb/1008524David Convery Pg 18 of 18 www.dailyhypervisor.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!