# Splunk: Setting up a SOC Lab

### Splunk: Deployment on Linux Server

Splunk supports all major OS versions, has very straightforward steps to install, and can be up and running in less than 10 minutes on any platform. In this task, we will only focus on installing Splunk Enterprise on the Linux host. Typically, we would create an account on [splunk.com](https://www.splunk.com/) and go to this [Splunk Enterprise](https://www.splunk.com/en_us/download/splunk-enterprise.html?locale=en_us) download link to select the installation package for the latest version. As of the time of writing, 9.0.3 is the newest version available on its website.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FExi6BvgNv8EBNl8BjQt8%2F2877a97b94aa31b1cce6420b7422c90c.png?alt=media&#x26;token=850e880f-27e4-435b-be4b-e1a9041d4acf" alt=""><figcaption></figcaption></figure>

Connect with the Lab

This task will explore installing and configuring Splunk on a Linux machine. Connect with the lab by pressing the Start Machine button at the top of this task, and it will start in Split Screen View on the right side of the screen. In case the VM is not visible, use the blue Show Split View button at the top-right of the page. It will take around 3-5 minutes to load fully.

For the sake of simplicity, the Splunk installer is already downloaded at the location `~/Downloads/splunk`

Splunk Installation

Splunk installation is as simple as running a command. You will need to uncompress Splunk by running the following command.

```
tar xvzf splunk_installer.tgz
```

After the installation is complete, a new folder named `splunk` will be created, as shown below. Let's now move this folder to the `/opt/` directory and start working on Splunk from there.

```
mv splunk /opt/
```

#### Starting Splunk

The above step unzips the Splunk installer and installs all the necessary binaries and files on the system. Once installed, go to the directory `/opt/splunk/bin` and run the following command to start Splunk `./splunk start --accept-license`. As it is the first time we are starting the Splunk instance, it will ask the user for admin credentials. Create a user account and proceed.

The above step unzips the Splunk installer and installs all the necessary binaries and files on the system. Once installed, go to the directory `/opt/splunk/bin` and run the following command to start Splunk `./splunk start --accept-license`. As it is the first time we are starting the Splunk instance, it will ask the user for admin credentials. Create a user account and proceed.

```
./splunk start --accept-license
```

#### Accessing Splunk

Congrats! - We successfully installed Splunk on our Linux machine, which took us less than 10 minutes. To access Splunk, open the browser within the VM and go to the address `http://coffely:8000`. If you are connected to the VPN, you can access Splunk right in your browser by going to the address. `http://10.10.43.189:8000`.

Use the credentials you created during the installation to access the Splunk dashboard.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FNqP8h1tAhL8VIXcYsVa8%2Ff2e3742660e69ec38c9d22ab57007202.png?alt=media&#x26;token=06220702-8474-4d1c-a1a5-920563f380d9" alt=""><figcaption></figcaption></figure>

### Splunk: Interacting with CLI

Now that we have installed Splunk, it's important to learn some key commands while interacting with Splunk instances through CLI. These commands are run from the `/opt/splunk/` directory. It is important to note that we can use the same commands on different platforms.

#### Command: splunk start

The `splunk start` command is used to start the Splunk server. This command starts all the necessary Splunk processes and enables the server to accept incoming data. If the server is already running, this command will have no effect.

```
./bin/splunk start
```

#### Command: splunk stop

The `splunk stop` command is used to stop the Splunk server. This command stops all the running Splunk processes and disables the server from accepting incoming data. If the server is not running, this command will have no effect.

```
./bin/splunk stop
```

#### Command: splunk restart

The `splunk restart` command is used to restart the Splunk server. This command stops all the running Splunk processes and then starts them again. This is useful when changes have been made to the Splunk configuration files or when the server needs to be restarted for any other reason.

```
./bin/splunk restart
```

#### Command: splunk status

The `splunk status` command is used to check the status of the Splunk server. This command will display information about the current state of the server, including whether it is running or not, and any errors that may be occurring.

#### Command: splunk add oneshot

The `splunk add oneshot` command is used to add a single event to the Splunk index. This is useful for testing purposes or for adding individual events that may not be part of a larger data stream.

```
./bin/splunk add oneshot
```

#### Command: splunk search

The `splunk search` command is used to search for data in the Splunk index. This command can be used to search for specific events, as well as to perform more complex searches using Splunk's search language.

```
./bin/splunk search coffely 
```

#### Command: splunk help

The most important command is the help command which provides all the help options.

```
./bin/splunk help
```

These are just a few of the many CLI commands available in Splunk. Administrators can use the CLI to manage and configure their Splunk servers more efficiently and effectively.

### Splunk: Data Ingestion

Configuring data ingestion is an important part of Splunk. This allows for the data to be indexed and searchable for the analysts. Splunk accepts data from various log sources like Operating System logs, Web Applications, Intrusion Detection logs, Osquery logs, etc. In this task, we will use Splunk Forwarder to ingest the Linux logs into our Splunk instance.

#### Splunk Forwarders

Splunk has two primary types of forwarders that can be used in different use cases. They are explained below:

#### Heavy Forwarders

Heavy forwarders are used when we need to apply a filter, analyze or make changes to the logs at the source before forwarding it to the destination. In this task, we will be installing and configuring Universal forwarders.

#### Universal Forwarders

It is a lightweight agent that gets installed on the target host, and its main purpose is to get the logs and send them to the Splunk instance or another forwarder without applying any filters or indexing. It has to be downloaded separately and has to be enabled before use. In our case, we will use a universal forwarder to ingest logs.

Universal forwarders can be downloaded from the official [Splunk website](https://www.splunk.com/en_us/download/universal-forwarder.html?locale=en_us). It supports various OS, as shown below:

Note: As of writing this, 9.0.3 is the latest version available on the Splunk site.

For this task, the 64-bit version of Linux Forwarder is already downloaded in the folder `~/Downloads/splunk`.

#### Install Forwarder

Change the user to sudo, unpack, and install the forwarder with the following command.

```
sudo su
tar xvzf splunkforwarder.tgz
```

The above command will install all required files in the folder `splunkforwarder`. Next, we will move this folder to `/opt/` path with the command `mv splunkforwarder /opt/`.

We will run the Splunk forwarder instance now and provide it with the new credentials as shown below:

```
mv splunkforwarder /opt/
cd /opt/splunkforwarder
./bin/splunk start --accept-license
```

By default, Splunk forwarder runs on port 8089. If the system finds the port unavailable, it will ask the user for the custom port. In this example, we are using 8090 for the forwarder.

### Configuring Forwarder on Linux

Now that we have installed the forwarder, it needs to know where to send the data. So we will configure it on the host end to send the data and configure Splunk so that it knows from where it is receiving the data.

#### Splunk Configuration

Log into Splunk and Go to Settings -> Forward and receiving tab as shown below:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2Fau0t7LvKaebaB9qtqtuy%2F5be56ab5768301a6f8b9eaaa91ffd581.png?alt=media&#x26;token=12ee19d7-3f1b-4638-a15c-cbf5f1713b09" alt=""><figcaption></figcaption></figure>

It will show multiple options to configure both forwarding and receiving. As we want to receive data from the Linux endpoint, we will click on Configure receiving and then proceed by configuring a new receiving port.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2Fe1tl1LsE22LllVJwt96e%2F64c55412514e56c05b91b8f9c4ba6060.png?alt=media&#x26;token=7c9a0997-9186-4e51-b5cd-b1540d0cbe60" alt=""><figcaption></figcaption></figure>

By default, the Splunk instance receives data from the forwarder on the port `9997`. It's up to us to use this port or change it. For now, we will configure our Splunk to start listening on port 9997 and Save, as shown below:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FzJI2pAkwzXLKSnK2Mwna%2F9a3f504672c0c499da3b5ab348b55a1f.png?alt=media&#x26;token=891aa27d-62cc-48a9-8159-174702280d8e" alt=""><figcaption></figcaption></figure>

Our listening port 9997 is now enabled and waiting for the data. If we want, we can delete this entry by clicking on the `Delete` option under the `Actions` column.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FSo0DHacS38fanFMPBBPj%2F2c3f58c3f084cef145523820ac3c35f9.png?alt=media&#x26;token=c3635a3b-dbd6-4cd9-b5a0-443515eee366" alt=""><figcaption></figcaption></figure>

#### Creating Index

Now that we have enabled a listening port, the important next step is to create an index that will store all the receiving data. If we do not specify an index, it will start storing received data in the default index, which is called the `main` index.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FeNLI83OyK2XfLbnS6PW3%2F525a1c69e54f9c53586dce9ab7e4f737.png?alt=media&#x26;token=b1f72168-84b3-4d2b-be11-22e8f4acb89a" alt=""><figcaption></figcaption></figure>

The indexes tab contains all the indexes created by the user or by default. This shows some important metadata about the indexes like Size, Event Count, Home Path, Status, etc.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FvbpHuCwMI5yuWgJG9t8y%2F452a24902c85e7793953d7e72534502b.png?alt=media&#x26;token=4176cbb4-58aa-4916-a8d7-b4440ea5b23f" alt=""><figcaption></figcaption></figure>

Click the New Index button, fill out the form, and click Save to create the index. Here we have created an index called `Linux_host` as shown below:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FhChHOEdc6nQreeINA9sX%2Fb69a6dcf0bc5538e1ca56bf58763779c.png?alt=media&#x26;token=5b1504f8-3979-4eba-832d-379ff68a5bad" alt=""><figcaption></figcaption></figure>

#### Configuring Forwarder

It's time to configure the forwarder to ensure it sends the data to the right destination. Back in the Linux host terminal, go to the `/opt/splunkforwarder/bin` directory:

```
./splunk add forward-server 10.10.43.189:9997
```

This command will add the forwarder server, which listens to port 9997.

#### Linux Log Sources

Linux stores all its important logs into the `/var/log` file, as shown below. In our case, we will ingest syslog into Splunk. All other logs can be ingested using the same method.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FilMfljLbUlmr7Q64rYMJ%2Fc9b649f6b18509635485702fc601f06f.png?alt=media&#x26;token=5c98e991-0c3b-4163-952c-6fec6bdec2c3" alt=""><figcaption></figcaption></figure>

Next, we will tell Splunk forwarder which logs files to monitor. Here, we tell Splunk Forwarder to monitor the `/var/log/syslog` file.

```
./splunk add monitor /var/log/syslog -index Linux_host
```

Exploring Inputs.conf

We can also open the inputs.conf file located in `/opt/splunkforwarder/etc/apps/search/local`, and look at the configuration added after the commands we used above.

```
cd /opt/splunkforwarder/etc/apps/search/local
cat input.conf
```

#### Utilizing Logger Utility

Logger is a built-in command line tool to create test logs added to the syslog file. As we are already monitoring the syslog file and sending all logs to the Splunk, the log we generate in the next step can be found with Splunk logs. To run the command, use the following command.

```
cd /opt/splunkforwarder/bin
logger "coffely-has-the-best-coffee-in-town"
tail -1 /var/log/syslog
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FqcMiNg8WvsBskUbGG0bx%2Fbc95b067dfb4addc351782d7dfe4cbdd.png?alt=media&#x26;token=ced5f568-1dce-4eb0-bf88-9524efe4bb55" alt=""><figcaption></figcaption></figure>

Great, We have successfully installed and configured Splunk Forwarder to get the logs fom the syslog file into Splunk.

### Q & A

1\) Follow the same steps and ingest `/var/log/auth.log` file into Splunk index Linux\_logs. What is the value in the sourcetype field?

```
./splunk add monitor /var/log/auth.log -index Linux_host
```

Answer:  syslog

2\) Create a new user named analyst using the command `adduser analyst`. Once created, look at the events generated in Splunk related to the user creation activity. How many events are returned as a result of user creation?

```
adduser analyst
```

Answer: 6

3\) What is the path of the group the user is added after creation?

Answer:  /etc/group

### Splunk: Installing on Windows

On the Windows machine, we will first install Splunk, configure a forwarder to capture Windows Event logs, and integrate `Coffely` weblogs to collect all requests and responses into Splunk Instance.

#### Downloading Splunk Enterprise

The first step would be to log in to the Splunk portal and download the Splunk Enterprise instance from the website, as shown below:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FuJOYmfb8fV4HZUvI55jX%2F5ed8e1ef1ea00799733b58549c5a925b.png?alt=media&#x26;token=d2d4c7df-b5f9-4aec-a9a5-dbcff5c2d94f" alt=""><figcaption></figcaption></figure>

The installer Splunk-Instance is already been downloaded and placed in the `Downloads` folder to speed up the process.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FT0gPpLV1Tm3x61xqmYbA%2Fb525f9ccf32ae135525304ac8f693557.png?alt=media&#x26;token=111eea50-13e5-41f8-b880-e658e36643e4" alt=""><figcaption></figcaption></figure>

Run the `Splunk-Instance` installer. By default, it will install Splunk in the folder `C:\Program Files\Splunk`. This will check the system for dependencies and will take 5-8 minutes to install the Splunk instance.

First, click the Check this box to accept the License Agreement and click Next.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FmmLutqL7lWGuP3hqON1H%2Faeff1a79db4e62e61a97f9ee612c7c55.png?alt=media&#x26;token=9bfacc4e-320d-40dd-ab94-c1ef1e433382" alt=""><figcaption></figcaption></figure>

#### Create Administration Account

The important step during installation is creating an administrator account, as shown below. This account will have high privileges, create and manage other accounts, and control all administrative roles.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FzVvIbrM2iewMadgPacQr%2F3ebfcc3f4a2f48356ebbe987abaf9796.png?alt=media&#x26;token=652af5c0-e1ed-48fb-9e59-64ae9396b9d1" alt=""><figcaption></figcaption></figure>

It will look for the system requirement for compatibility and other checks.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2Fm9sYDgGdrbJMlTFQW4LQ%2F58bd917c04524e963db6853078fc46b9.png?alt=media&#x26;token=8d6e5b73-d3c9-443e-8d41-5459b80d80f6" alt=""><figcaption></figcaption></figure>

We will get the following message if all system requirements are met, and installation is complete.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FBgvocEuI5z8787UpWTtS%2Fc4db4c0b5fd17c0d287dc270619580dc.png?alt=media&#x26;token=c7dde392-6202-45ba-bc02-e8baa36bb799" alt=""><figcaption></figcaption></figure>

#### Accessing Splunk Instance

Splunk is installed on port `8000` by default. We can change the port during the installation process as well. Now open the browser in the lab and go to the URL `HTTP://127.0.0.1:8000`. If you are connected with the VPN, then you can also access the newly installed Splunk Instance in your browser by going to  `HTTP://10.10.64.28:8000`.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FbMuWL9SWC6GKHga0Pf9F%2F721ff9c0f684779dcee3a95ebb6010f0.png?alt=media&#x26;token=06fec7e5-74e1-4501-863a-708985fc42d0" alt=""><figcaption></figcaption></figure>

Use the credentials created during the installation process to get the Splunk dashboard.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FWoHeLyni4Nyn4fUJQdHV%2Fd3d386978ab713e99144ab4131e16229.png?alt=media&#x26;token=1e06926a-634c-42f0-82f7-014be9a71c32" alt=""><figcaption></figcaption></figure>

Great. We have successfully installed Splunk on a Windows OS. In the next task, we will follow similar steps we did during Linux Lab to install Splunk Forwarder.

### Installing and Configuring Forwarder

First, we will configure the receiver on Splunk so the forwarder knows where to send the data.

#### Configure Receiving

Log into Splunk and Go to Settings -> Forward and receiving tab as shown below:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2Ft9Rv40MnH5VaMmhmwLki%2F0f7b0ea014b250e34c50e9eadacd2e90.png?alt=media&#x26;token=fdb66107-65f1-463c-88e1-713d218d08b4" alt=""><figcaption></figcaption></figure>

It will show multiple options to configure both forwarding and receiving. As we want to receive data from the Windows Endpoint, we will click on Configure receiving and then proceed by configuring a new receiving port.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2F2X0PPdVdidLmyOwBLv8J%2Fc6ed21adbe533ae0b62ecc1549aa07cd.png?alt=media&#x26;token=19e06b9d-4d08-4e33-aa42-f8c1937708f8" alt=""><figcaption></figcaption></figure>

By default, the Splunk instance receives data from the forwarder on port `9997`. It's up to us to use this port or change it. For now, we will configure our Splunk to start listening on port 9997 and Save, as shown below:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FShkhbBidmcTU3qLyYwGA%2F5f8547e6cc1db7fe8c154125fd9dbf57.png?alt=media&#x26;token=025b097a-78ca-4161-a5ff-b40317fe6630" alt=""><figcaption></figcaption></figure>

#### Installing Splunk Forwarder

Installing Splunk Forwarder is very straightforward. First, we will download the latest forwarder from the official website [here](https://www.splunk.com/en_us/download.html). As of writing this, Splunk Forwarder 9.0.4 is the newest version available on the site.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FPL2t9VNAY8VfF4GskKla%2Fcd3e37d24fc3eddc642419628612c6a6.png?alt=media&#x26;token=e06ffd13-556d-4952-93a8-929b8c588c52" alt=""><figcaption></figcaption></figure>

For this lab, the forwarder is already downloaded and placed in the Downloads folder, as shown below:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FKTXZoAujJ4oUAsxWGATU%2F07fef7e7cf1635e63a8907965350b89f.png?alt=media&#x26;token=ba609958-ac49-42e0-b910-f9604a801a8c" alt=""><figcaption></figcaption></figure>

#### Installation Process

Click on the installer and begin installing Splunk Forwarder, as shown below. Don't forget to click the Check this box to accept the License Agreement. Select the Select the On-Premises Option as we are installing it on an on-premises appliance.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FCcLalFayy6rB35m1F42b%2Fc6df0b12d831de145b91587d3da61247.png?alt=media&#x26;token=679f2f33-0e24-427d-a5e3-16a056b3f430" alt=""><figcaption></figcaption></figure>

Create an account for Splunk Forwarder. This will be used when connecting the Splunk forwarder to the Splunk Indexer.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2F51rfFQBBU8SIPEKuWvLc%2Fe9b77f24422620244cb0a844c7bd1723.png?alt=media&#x26;token=df9c66fe-052c-43b3-b972-6dc9955a40f0" alt=""><figcaption></figcaption></figure>

#### Setting up Deployment Server

This configuration is important if we install Splunk forwarder on multiple hosts. We can skip this step as this step is optional.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FKq6jlUItxA599EB9EDXj%2Fb71e007cf3baa869948d342d10996650.png?alt=media&#x26;token=4492c907-2c17-4b87-ae72-03188e981976" alt=""><figcaption></figcaption></figure>

#### Setting Up Listener

We must specify the server's IP address and port number to ensure that our Splunk instance gets the logs from this host. By default, Splunk listens on port `9997` for any incoming traffic.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FQmf0OHm3oDVHMK0dzEPV%2F37467762b612abf6193b798d655afcda.png?alt=media&#x26;token=b55dfd96-dca3-400f-931c-2390ca025119" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FHmpjhhXy6fx2eAeVG79B%2Fe56ee367b75db022b305f54f6839e483.png?alt=media&#x26;token=c2cf133e-0e5c-4fef-8088-fab039355ef3" alt=""><figcaption></figcaption></figure>

If we had provided the information about the deployment server during the installation phase, our host details would be available in the Settings -> Forwarder Management tab, as shown below:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FcKyUDTmOnkcQbrinQJgY%2Fdbd889863a7e203791da8b3295b31bf2.png?alt=media&#x26;token=d6ea666d-5d87-4579-a7a9-ab6e359cc0ea" alt=""><figcaption></figcaption></figure>

Now that Splunk forwarder is installed, we will now configure our forwarder to send logs to our Splunk instance in the upcoming tasks.

### Splunk: Ingesting Windows Logs

We have installed the forwarder and set up the listener on Splunk. It's time to configure Splunk to receive Event Logs from this host and configure the forwarder to collect Event Logs from the host and send them to the Splunk Indexer. Let's go through this step by step.

#### Check Forwarder Management

The Forwarder Management tab views and configures the deployment of servers/hosts.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2F9Lg7Ieyd2Gm7VyWSVY66%2F846f664b8a8a4ebb560fb97e220547b1.png?alt=media&#x26;token=f066901f-be39-46c9-8ab2-c7e3194e7f85" alt=""><figcaption></figcaption></figure>

Go to settings -> Forwarder Management tab to get the details of all deployment hosts. In an actual network, this tab will be filled with all the hosts and servers configured to send logs to Splunk Indexer.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FHdv4hbLiobBTUUXoYn44%2Fc180ba12568b1878c38c9a448e866430.png?alt=media&#x26;token=5e733695-14b8-45e9-a2db-88f8b4a867f0" alt=""><figcaption></figcaption></figure>

It will appear here if we have properly configured the forwarder on the host. Now it's time to configure Splunk to receive the Event Logs.

#### Select Forwarder

Click on Settings -> Add data. It shows all the options to add data from different sources.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FNbc2ZN460gcbR4RCKAxs%2F7aafc3f62d618f4937e9033617b77f12.png?alt=media&#x26;token=af85c740-03b6-400e-b092-fe4ca7068e10" alt=""><figcaption></figcaption></figure>

It provides us with three options for selecting how to ingest our data. We will choose the `Forward` option to get the data from Splunk Forwarder.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FaAfRQqk4ClV5iGPtjyKA%2Fb361fa4806df2ecf712688312cd1b4e2.png?alt=media&#x26;token=c7c0feb8-b372-491b-b5fa-84e1db15930f" alt=""><figcaption></figcaption></figure>

In the Select Forwarders section, Click on the host `coffelylab` shown in the Available host(s) tab, and it will be moved to the Selected host(s) tab. Then, click Next.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2F4gkJIpZvMYR6KbV1fxUn%2Fd3287bc6d57de2ad81be3688bc4f28ac.png?alt=media&#x26;token=d3da946d-9fce-4200-a80f-e464929d4c42" alt=""><figcaption></figcaption></figure>

#### Select Source

It's time to select the log source that we need to ingest. The list shows many log sources to choose from. Click on Local Event Logs to configure receiving Event Logs from the host. Different Event Logs will appear in the list to choose from. As we know, various Event Logs are generated by default on the Windows host. More about Event Logs can be learned in this [Windows Event Logs](https://tryhackme.com/room/windowseventlogs) room. Let's select a few of those and move to the next step.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2F8kOL1r9oSRScofP5D4DH%2F46f4a32438800393030eade6eee7f21c.png?alt=media&#x26;token=c9080fa8-d9f3-4a32-9691-7f2994b58c47" alt=""><figcaption></figcaption></figure>

#### Creating Index

Create an index that will store the incoming Event logs. Once created, select the Index from the list and move to the next step.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FidOM7nsUp5y461JDzE0f%2Fad8db61e06b6f3a5847cb70d96267fa8.png?alt=media&#x26;token=dd2f134f-8ed3-4e40-b808-b954647fe3e9" alt=""><figcaption></figcaption></figure>

#### Review

The review tab summarizes the settings we just did to configure Splunk. Move to the next step.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2Fyt9ySrXel3wxXETP0ytK%2Fc0f5d5a4e74e03cba6621d73f9c6c4ce.png?alt=media&#x26;token=02870e12-6bea-44fb-8e21-65b699565417" alt=""><figcaption></figcaption></figure>

Click on the Start Searching tab. It will take us to the Search App. If everything goes smoothly, we will receive the Event Logs immediately.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FJsVfKsRB1fQ3VzW3L945%2F462f4fafe7eca7399709bf8bdc5b81c5.png?alt=media&#x26;token=efc5c5e7-43c6-4050-99ec-17e303a17137" alt=""><figcaption></figcaption></figure>

Great. We have successfully configured Splunk to receive Event Logs from the Windows host. Let's move on to the next task, where we will look at the steps to ingest weblogs.

### Q & A

1\) While selecting Local Event Logs to monitor, how many Event Logs are available to select from the list to monitor?

Answer:  5

2\) Search for the events with EventCode=4624. What is the value of the field Message?

Answer:  An account was successfully logged on

### Ingesting Coffely Web Logs

The Windows host we connected to Splunk Instance also hosts a local copy of their website, which can be accessed via  `http://coffely.thm` from the VM and is in the development phase. You are asked to configure Splunk to receive the weblogs from this website to trace the orders and improve coffee sales.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FNS6BvOq7eY6v0QOGfLl4%2F78e190a4246f52b9774eb65e339384e1.png?alt=media&#x26;token=16ac3f83-d6f7-4587-8a04-ad92f3edaccb" alt=""><figcaption></figcaption></figure>

This site will allow users to order coffee online. In the backend, it will keep track of all the requests and responses and the orders placed. Now let's follow the next steps to ingest web logs into Splunk.

#### Add Data

Go to settings -> Add Data and select Forward from the list, as shown below:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FK5ZlCUi401Rz3K1e6b5q%2F588a1abdd12be55a14a301b97dfb5f41.png?alt=media&#x26;token=8ddedc9a-7640-423d-92b1-83c68c5ffd32" alt=""><figcaption></figcaption></figure>

Select the Forwarder option:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2Fh5qSYk8gBRJMDbTSxcCZ%2F6c992411f2feac2abe1d821471a00eef.png?alt=media&#x26;token=bafafc96-e440-4707-86ef-e10f5a5fa65f" alt=""><figcaption></figcaption></figure>

#### Select Forwarder

Here we will select the Web host where the website is being hosted.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FXzAg0IlKSUfsmPrqdIsv%2F3ac2b8256c65d153c1769ca1e5d42504.png?alt=media&#x26;token=069d86f9-8b73-4282-8a7d-9ba71e52675c" alt=""><figcaption></figcaption></figure>

Web logs are placed in the directory `C:\inetpub\logs\LogFiles\W3SVC*`. The directory may contain one or more log files which will be continuously updated with the logs. We will be configuring Splunk to monitor and receive logs from this directory.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FZtcqd6eUhShKGH3FhLYR%2F1adbc28a09c4e09adc64aa3ca16fd68a.png?alt=media&#x26;token=06999461-daf5-44c0-8077-e77667e3dc35" alt=""><figcaption></figcaption></figure>

#### Setting up Source Type

Next, we will select the source type for our logs. As our web is hosted on an IIS server, we will choose this option and create an appropriate index for these logs.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FDMsPztaywn69yinVUUVU%2Fefdc7ed1b3dcfb0fb3553e39b851ab85.png?alt=media&#x26;token=6b19db2d-19d4-4ac5-83c8-59b26862d84a" alt=""><figcaption></figcaption></figure>

We can look at the summary to see if all settings are fine.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FIiuBa3PElcTNoo2ibVBJ%2F92348ac194c35ef7d7b72bf05ee86c01.png?alt=media&#x26;token=0d22738a-326f-4087-83d4-d5ae9a23fb5b" alt=""><figcaption></figcaption></figure>

Now everything is done. It's time to see if we get the weblogs in our newly created index. Let's visit the website `coffely.thm` and generate some logs. The logs should start propagating in about 4-5 minutes in the search tab, as shown below:

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FKQFVlbAHJz0y5zvtpTMG%2F94d04fa38c4290e0f3b4a7b801c8d902.png?alt=media&#x26;token=a03ca9d3-b546-416f-92a2-69ad38c041a5" alt=""><figcaption></figcaption></figure>

Excellent. It looks like we were successful in getting the weblogs ingested into Splunk. However, the logs may need proper parsing and normalizing, which is something to be discussed in upcoming rooms.

### Conclusion

This is it!\
Understanding the process of installation and configuration of any SIEM solution and then ingesting logs from various sources is a very important concept for a SOC analyst. In this room, we learned how to:

* Install Splunk both on Linux and Windows Host.
* Install Splunk Forwarder on Linux and Windows Host.
* Configure Splunk to receive OS-based and Web logs.

More advanced topics will be covered in future rooms.
