> ## Documentation Index
> Fetch the complete documentation index at: https://docs.levelblue.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Submitting a custom query

**To submit a custom query:**

1. Go to **Data Sources** > **Hunting Library**.
2. Click **Create Custom Query**. The **New Query** section appears.

![](https://mintcdn.com/levelblue-5324744e/NfRKlZ9BkswRFp4P/images/usm-anywhere/NewQuery.png?fit=max\&auto=format\&n=NfRKlZ9BkswRFp4P\&q=85\&s=e7579ac5064d8d1f09f1a44f329edfd8)

3. Enter and set your query:
   * Enter your **New Query** using Structured Query Language (SQL) or Piped Processing Language (PPL) syntax.
   * Select the **Favorite** checkbox for any new custom query that you want to appear at the top of the **Saved Custom Queries** list. See [Favorite a query](https://docs.levelblue.com/documentation/usm-anywhere/user-guide/advanced-query/favorite-a-query.md).
   * Select **SQL** or **PPL** as the query language from the dropdown list.

     > [!NOTE]
     >
     > The selected language must match the syntax of your query; otherwise, it will not run. See [SQL Queries](https://docs.levelblue.com/documentation/usm-anywhere/user-guide/advanced-query/sql-queries.md) and [PPL Queries](https://docs.levelblue.com/documentation/usm-anywhere/user-guide/advanced-query/ppl-queries.md) for more information.
   * Select the time range for your query. The default value is **Last Hour**.
4. Click Search to run the query. Results are displayed and can be generated in CSV format. Refer to [Generating CSV Report](https://docs.levelblue.com/documentation/usm-anywhere/user-guide/advanced-query/generate-csv-report.md) for more information.

   > [!TIP]
   >
   > You may also save your custom query for future use. See [Saving a Query](https://docs.levelblue.com/documentation/usm-anywhere/user-guide/advanced-query/save-a-query.md).

> [!NOTE]
>
> If you are unsure of a field name, refer to the [List of Fields](https://docs.levelblue.com/documentation/usm-anywhere/user-guide/advanced-query/list-of-fields.md) for a complete list of available queryable fields across Events, Alarms, Vulnerabilities, and more.
