> For the complete documentation index, see [llms.txt](https://baric6.gitbook.io/barics-knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://baric6.gitbook.io/barics-knowledge-base/development/siems-and-edr/splunk/data-searches/spl-breakdown.md).

# SPL Breakdown

### Comparison Operators

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2F0kLsKA8B948CUCpOUJDx%2F681a126a98263612b87def7014583ffb.png?alt=media&amp;token=2446880b-00d0-4af2-9866-7b234c5104a2" alt=""><figcaption></figcaption></figure>

| <p>Field Name<br></p>               | <p>Operator<br></p> | <p>Example<br></p>                   | <p>Explanation<br></p>                                                                                                                                                        |
| ----------------------------------- | ------------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Equal<br></p>                    | <p>=<br></p>        | UserName=Mark                        | <p>This operator is used to match values against the field. In this example, it will look for all the events, where the value of the field UserName is equal to Mark.<br></p> |
| <p>Not Equal to<br></p>             | <p>!=<br></p>       | UserName!=Mark                       | <p>This operator returns all the events where the UserName value does not match Mark.<br></p>                                                                                 |
| <p>Less than<br></p>                | <p><<br></p>        | Age < 10                             | <p>Showing all the events with the value of Age less than 10.<br></p>                                                                                                         |
| <p>Less than or Equal to<br></p>    | <p><=<br></p>       | Age <= 10                            | Showing all the events with the value of Age less than or equal to 10.                                                                                                        |
| <p>Greater than<br></p>             | <p>><br></p>        | <p>Outbound\_traffic > 50 MB<br></p> | <p>This will return all the events where the Outbound traffic value is over 50 MB.<br></p>                                                                                    |
| <p>Greater Than or Equal to<br></p> | <p>>=<br></p>       | Outbound\_traffic >= 50 MB           | This will return all the events where the Outbound traffic value is greater or equal to 50 MB.                                                                                |

### Boolean Operators

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2Fgbjz3LX5m6DhJLnImKiK%2F42c8963dccbd05128f52665c38877f47.png?alt=media&amp;token=b149acca-df29-44c4-a6fe-5068d3b4e116" alt=""><figcaption></figcaption></figure>

| <p>Operator<br></p> | <p>Syntax<br></p>                             | <p>Explanation<br></p>                                                                   |
| ------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------- |
| <p>NOT<br></p>      | <p>field\_A NOT value<br></p>                 | <p>Ignore the events from the result where field\_A contain the specified value.<br></p> |
| <p>OR<br></p>       | <p>field\_A=value1 OR field\_A=value2<br></p> | <p>Return all the events in which field\_A contains either value1 or value2.<br></p>     |
| <p>AND<br></p>      | field\_A=value1 AND field\_B=value2           | Return all the events in which field\_A contains value1 and field\_B contains value2.    |

### Wild Card

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FYf42MBaZW1O5nvMGe9k4%2F5530cae0739755e6a682641f5057b1a5.png?alt=media&amp;token=4567b3b1-e485-46ee-90a1-d70d74d3e399" alt=""><figcaption></figcaption></figure>

| Wildcard symbol   | <p>Example   <br></p> | <p>Explanation         <br></p>                                                                 |
| ----------------- | --------------------- | ----------------------------------------------------------------------------------------------- |
| <p>\*<br><br></p> | status=fail\*         | <p>It will return all the results with values like</p><p>status=failed</p><p>status=failure</p> |

### Fields

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2F0BVeHg774yG6ycrwA3Yh%2Fdd77983b5fccf5eacfa73aacbeb7a314.png?alt=media&amp;token=7db94970-c6ea-4f9f-b957-9453298f9b47" alt=""><figcaption></figcaption></figure>

### Search

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FAdzQ6ib1U7Ra2ZXfALX1%2F02d2ece97e7f977e32b4c11fd86e41eb.png?alt=media&amp;token=b73eb726-b600-44bd-a496-f473d09abed8" alt=""><figcaption></figcaption></figure>

### Dedup

The command used to remove duplicate fields from the search results. We often get the results with various fields getting the same results. These commands remove the duplicates to show the unique values.

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FRvWQLVP1BHBeQfSNeZ5M%2F47bb3fb904c84acdbe7cb89dda535ac1.png?alt=media&amp;token=1a5fcc7d-1f19-4fe1-8666-1dba2e744242" alt=""><figcaption></figcaption></figure>

### Rename

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FG4JsdZb7nDbDn8Bf47T8%2F61e56df15649aa12b4be7c91d8cc91ce.png?alt=media&amp;token=12f168a0-e650-490e-82bb-9f6e61ae02c6" alt=""><figcaption></figcaption></figure>

### Table

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2Fvd5lyaKsTogUVi3nIrU8%2F643f5cc127276645eb0fd7fdb339cb29.png?alt=media&amp;token=b113f367-c708-4876-b0bc-12d1e1dfeb4e" alt=""><figcaption></figcaption></figure>

### Head

The head command returns the first 10 events if no number is specified.

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FJx7XktFr5YUWh8BZQAQq%2F3a9df7382d1f5e2e3302750dc5016809.png?alt=media&amp;token=f8a4f7f4-bf53-43c6-9fe4-24fb0aad7a9e" alt=""><figcaption></figcaption></figure>

### Tail

The Tail command returns the last 10 events if no number is specified.

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FVDHI3i9ufCoJLihLT4es%2F917811648cc95bd3f34c820a473b9c1b.png?alt=media&amp;token=0f373381-7d20-4fd2-a477-e5c1dc499587" alt=""><figcaption></figcaption></figure>

### Sort

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FsR9OJLMbYJPpvWhh0Bnc%2F9589d101b5a07f69fc4771a6c1e54e14.png?alt=media&amp;token=dd58de56-c467-427f-b768-6913fb85f451" alt=""><figcaption></figcaption></figure>

### Reverse

The reverse command simply reverses the order of the events.

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FQ4jn6PwWoJoloRHJFZnF%2F0de4064ec74ee5f64a399e0a7bed9200.png?alt=media&amp;token=c96abb67-4b69-495e-8517-24788c90db5b" alt=""><figcaption></figcaption></figure>

### Top

This command returns frequent values for the top 10 events.

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2Fr63mHgwPghkgvYK961e3%2Fffef6c0a6ce0159e6d970de2c32921a3.png?alt=media&amp;token=9085b746-98d9-4897-a638-7d805abcb77a" alt=""><figcaption></figcaption></figure>

### Rare

This command does the opposite of top command as it returns the least frequent values or bottom 10 results.

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FjJY7yGQlWFXv7TCcDzPM%2F8123e0932c169514d9842fbba8f5898c.png?alt=media&amp;token=1672e0f3-41ee-4723-bfdc-6c406dff0273" alt=""><figcaption></figcaption></figure>

### Highlight

The highlight command shows the results in raw events mode with fields highlighted.

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FYtnNit52Kk5c6OOxTFds%2F61ad47b204639fa0f75b278bec21abac.gif?alt=media&amp;token=6a647bd4-6465-4cad-93ad-0ea0d3459a12" alt=""><figcaption></figcaption></figure>

### Stats

| <p>Command<br></p> | <p>Explanation<br></p>                                            | <p>Syntax<br></p>                  | <p>Example<br></p>                  |
| ------------------ | ----------------------------------------------------------------- | ---------------------------------- | ----------------------------------- |
| <p>Average<br></p> | This command is used to calculate the average of the given field. | stats avg(field\_name)             | stats avg(product\_price)           |
| <p>Max<br></p>     | It will return the maximum value from the specific field.         | stats max(field\_name)             | stats max(user\_age)                |
| <p>Min<br></p>     | It will return the minimum value from the specific field.         | stats min(field\_name)             | stats min(product\_price)           |
| <p>Sum<br></p>     | It will return the sum of the fields in a specific value.         | stats sum(field\_name)             | <p>stats sum(product\_cost)<br></p> |
| <p>Count<br></p>   | The count command returns the number of data occurrences.         | stats count(function) AS new\_NAME | stats count(source\_IP)             |

### Chart

The chart command is used to transform the data into tables or visualizations.

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FvECPVcuu9UPq5MEEnMyk%2Fa954b0a1d37542650df294461d756c61.gif?alt=media&amp;token=04decc69-a4d4-44cc-b63a-30331fca3c48" alt=""><figcaption></figcaption></figure>

### Timechart

The timechart command returns the time series chart covering the field following the function mentioned. Often combined with STATS commands.

<figure><img src="https://2273033137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGlSezkssK5aHdG6Al3xJ%2Fuploads%2FwmdQBkFvq8mkYTeTPNYj%2Fbc7f90e4f40be4c047d250d5e3ee44c8.gif?alt=media&amp;token=ede4d4f7-603f-46f6-b0b4-9ba1ff3ad8ce" alt=""><figcaption></figcaption></figure>
