In this lab we will teach you how to setup your own Splunk server. You will also learn how you can forward logs from different endpoint devices to your Splunk logs, aka ingesting logs. After you get comfortable ingesting logs we will also be generating our own log sources and learning how we can ingest those logs too.
As more and more people complete the beginner lab we will start working on a more advanced lab for people interested in learning more about Splunk.
SDC Kamino Instructions
First you will need to download and install Pritunl
Next download this vpn profile sdc_vpn.ovpn
Import the profile using Pritunl. Dont enter a profile url.
Once Imported, connect to the sdc_vpn and use the credentials below
user:vpn
password:141252
Open up a web browser and navigate to https://kamino.calpolyswift.org/#/
Register an account and login
Click the drop down under Deploy Pod From Template
and select SOC - Splunk Lab
- ignore any errors about clone failed.
Click the refresh icon when complete. Click OPEN POD ON ELSA.SDC.CPP
Press "Advanced" and "proceed to unsafe"
Login using the account you created in step 6
Click on the burger menu on the top left and select Inventory
Select the second icon
that has 3 squares overlapping on paper
Drill down into the menu until you see 4 VMs. Power on the VMs provided by pressing the play button or going to Actions->Power->Power ON
You are now ready to start the lab. If you get stuck on any stage feel free to reach out Joe | Shobra on Discord.
After you complete the setup of the lab, we will now work with the vm called "Splunk Server".
Task 1 is to create your very own Splunk server. When I say create I simply mean install the Splunk Enterprise Trial(https://www.splunk.com/en_us/download/splunk-enterprise.html), run it and acces it.
Note the username is
soc
and password is1234
IMPORTANT: Before you start run
su -
to login as the root user.
Here are some guiding qustions you should be asking yourself to get you started:
Where can I download Splunk Enterprise Trial?
How do you install a .deb package?
Where is the default location Splunk gets installed on Linux?
How do I run Splunk?
How do I access the Splunk web interface?
If you are stuck check out the hints. Good luck!
For the Splunk Server, we would want to download the .deb file. Copy the wget command in the terminal and run it to download Splunk Enterprise Trial or just click the download button.
In debian we use the dpkg -i packages to install packages.
wget -O splunk-9.3.0-51ccf43db5bd-linux-2.6-amd64.deb "https://download.splunk.com/products/splunk/releases/9.3.0/linux/splunk-9.3.0-51ccf43db5bd-linux-2.6-amd64.deb"
dpkg -i splunk-9.3.0-51ccf43db5bd-linux-2.6-amd64.deb
cd /opt/splunk/bin
./splunk start
Open the link shown on your terminal e.g. http://splunkserver:8000
Login with the user account you created when installing Splunk.
On the Splunk Server navigate to the app called "Search & Reporting". Once it loads, skip the tour and you should see a huge search bar on screen. This is the main way we will be searching for the data the comes into your Splunk Server. Try searching index="main"
and press enter. Notice that you do not see any data and that is expected because we have not gathered any data yet. We will be doing this in the next task.
Congratulations you have successfully installed and accessed your first Splunk Server!
If you havent already, I encourage you to take explore the UI of Splunk. It will be quite a lot to absorb at first but I promise you as you keep using Splunk you will get used to the UI.
Congratulations if you made it this far that means you successfully setup your own Splunk server!
Task 2 is to install the Splunk Universal Forwarder on the Windows Endpoint and see if you can query the logs using the Splunk Search App. Go back to the tab you used to access the Splunk Server and power on and connect to the Windows Endpoint.
Now that we set up a Splunk server we need to figure out how we can ingest logs into it. We ingest logs using something called the Splunk Universal Forwarder(https://www.splunk.com/en_us/download/universal-forwarder.html). This is a tool installed on an endpoint device that tells the computer which logs to send and where to send them.
If you are able to see data when searching index=main on the Splunk Search App you have successfully completed the task.
Here are some guiding qustions you should be asking yourself to get you started:
Where can I download Splunk Universal Forwarder?
How do you install Splunk Universal Forwarder on Windows?
How do I check if the Splunk Universal Forwarder is running?
What firewall ports number does Splunk Universal Forwarder use?
What communication protocol does Splunk Universal Forwarder use?
How do I open the firewall port on Windows?
How do I receive data on the Splunk Server?
IMPORTANT: When installing the Splunk Universal Forwarder click on the Customize Options and during one of the steps make sure you select the Local System option. ALSO SKIP THE DEPLOYMENT SERVER IP ADDR. This is something different.
If you made a mistake you can always uninstall the Splunk Universal Forwarder by going to Control Panel -> uninstall a Program and uninstall Splunk Universal Forwarder.
If you think you did everything correctly you should be able to query index="main" in your Splunk Server to see the data.
wget -O C:\splunkforwarder-9.3.0-51ccf43db5bd-x64-release.msi "https://download.splunk.com/products/universalforwarder/releases/9.3.0/windows/splunkforwarder-9.3.0-51ccf43db5bd-x64-release.msi"
This will downloaded the installer to you C:\ folder.
Open up Windows Firewall and open the Advanced options. Create a new outbound rule for port TCP 9997 and allow the connection. Do the same but for an inbound connection if you are using a Windows server to run Splunk Enterprise.
On your Splunk Server login using the credentials you created and go to Settings->Forwarding and Receiving and under the Receive Data section click on +Add New. Enter 9997 as listening port and save.
Go to your Splunk Search Head and search index=main.
You should see data in this index after a few minutes.
Nicely done comrade! You have now successfully forwarded the logs from a Windows device. The Windows logs you have forwarded to Splunk can be found locally in C:\WINDOWS\system32\winevt\Logs. I encourage you to navigate there yourself to see what else is available. Also you can use Event Viewer on Windows to make it easier to view logs.
In Task 3 you will have to do the same thing you did in Task 2 but now for Linux!
Keep in mind that the Linux logs are named differently and stored in a different folder than Windows.
Here are some qustions you should be asking yourself to get you started:
Similar to the Splunk Server install you use the dpkg -i
to install the Splunk Universal Forwader on Debian.
Start the Splunk Universal Forwarder and check that it is running using the command systemctl status SplunkForwarder.service
wget -O splunkforwarder-9.3.0-51ccf43db5bd-linux-2.6-amd64.deb "https://download.splunk.com/products/universalforwarder/releases/9.3.0/linux/splunkforwarder-9.3.0-51ccf43db5bd-linux-2.6-amd64.deb"
Go to your search app in the Splunk Server and run index=main. If you see another host with the name deb12 you have successfully completed this task.
Wow you really must like Splunk if you came this far
Task 4 will be a quick and easy one.
Notice how all your indexes are being sent to main by default. Imagine ingesting 100s of log sources into main. How messy does that look. It would also be a nightmare querying specific data and very inefficient.
Task 5 is to create new indexes and change the behaviour of the Universal Forwarder.
Create an index called Windows and another one called Linux. Our goal is to send the logs from Windows to the Windows index and the logs from Linux to the Linux index.
Here are some qustions you should be asking yourself to get you started:
In Windows you can find the inputs.conf under 'C:\Program Files\SplunkUniversalForwarder\etc\apps\SplunkUniversalForwarder\local'
Open notepad as Administrator and open inputs.conf
Add the line index = Windows
under each section of logs. e.g.
[WinEventLog://Application]
checkpointInterval = 5
current_only = 0
disabled = 0
start_from = oldest
index = Windows
Save the file
Open the Services app and restart the Splunk Universal Fowarder.
In Linux you can find the inputs.conf under '/opt/SplunkUniversalForwarder\etc\apps\search\local'
Run 'nano inputs.conf' to dedit
Add the line index = Windows
under each section of logs. e.g.
[monitor:///var/log]
disabled = 0
index = Linux
Save the file
Open the Services app and restart the Splunk Universal Fowarder.
If you come this far pat yourself on the back!
You essentially now have a good understanding on how logs are ingested into Splunk and you have a basic understanding of how to change the flow of data.
Remember how easy it was when you forwarded logs using the Windows forwarder o forward data using the settings in the nice GUI? Well what if we wanted to send logs from other programs that are not listed in the installer? The good news is that since you fundamentally know how to send logs and which file controls that we can forward any data we want! Thats crazy!!
Task 5 is to install [Sysmon] on your Windows Endpoint (https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon) with SwiftOnSecurity configuration and ingest the logs Sysmon generates into Splunk.
If you are able to see WinEventLog:Microsoft-Windows-Sysmon/Operational
in the Sources Field when searching index=main you have successfully completed the task.
If you are installing with new config use
.\Sysmon64.exe -accepteula -i sysmonconfig-export.xml
If you already installed Sysmon using default config use this command to update the config.
.\Sysmon64.exe -c sysmonconfig-export.xml
Add the following lines to your inputs.conf file that you are using
[WinEventLog://Microsoft-Windows-Sysmon/Operational]
checkpointInterval = 5
current_only = 0
disabled = 0
start_from = oldest
index = main
Restart the Splunk universal forwarder service
If you enjoyed this lab and want to learn more feel free to reach out to us on Discord!
Congratulations you have completed the Splunk Lab!
Hope you enjoyed the lab! If you want to work on more Splunk stuff or like what you see at the SOC, I encourage you to get involved and start working on your own cool project . You are now dubbed Splunk Pro!
Stay tuned for a more advanced Splunk Lab where we plan to tackle the following questions:
-How do I scale my Splunk deployment?
-How do I make my Splunk server more resilient?
-How do I increase search performance?