> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-xdr/insights-and-tips-cortex-xdr/data-and-platform-administration/parsing-and-xql.md).

# Parsing and XQL

Learn how to create parsing rules in Cortex XDR and use XQL to transform, filter, aggregate, combine, and schedule log data queries.

### Parsing rules

Parsing rules transform raw logs into structured rows in a dataset. They are written in XQL for parsing.

| Format                | How to parse                                                                                        |
| --------------------- | --------------------------------------------------------------------------------------------------- |
| Unstructured text     | `regexcapture` (parsing rules only) and `regextract` (RE2 regex)                                    |
| JSON                  | `parse_json`, `json_extract`, `json_extract_scalar`, `json_extract_array`, or arrow notation (`->`) |
| XML and other formats | Use string functions (`split`, `arrayindex`, `replace`) and regex to extract values                 |
| CEF and LEEF          | Parsed automatically by the collectors                                                              |

Set a `no_hit` policy to keep or drop logs that no rule matches. See [Parsing Rules file structure and syntax](https://cortex-docs.paloaltonetworks.com/cortex-xdr-5.x/configure-cortex-xdr/data-management/parsing-rules/parsing-rules-file-structure-and-syntax).

### XQL capabilities

XQL is a pipeline query language: each stage, separated by `|`, transforms the results of the previous stage.

* **Filter and shape:** `filter`, `fields`, `alter`, `sort`, `limit`, `dedup`.
* **Aggregate:** `comp` with `count`, `sum`, `avg`, `min`, `max`, and more, grouped `by` fields.
* **Combine data:** `join` (inner, left, and right) and `union`.
* **JSON:** `json_extract` functions and arrow notation, for example `event -> user.name`.
* **Correlate and schedule:** Save queries as correlation rules, or run them on a schedule.

See the [XQL command reference](https://cortex-docs.paloaltonetworks.com/xql-command-reference-guide/readme).

You can also write queries in natural language with the Agentic Assistant, which translates your request into XQL. See [Create and run XQL queries with Agentic Assistant chat](https://cortex-docs.paloaltonetworks.com/cortex-xdr-5.x/detect-investigate-and-respond-to-threats/agentic-assistant-chat/create-and-run-xql-queries-with-agentic-assistant-chat).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-xdr/insights-and-tips-cortex-xdr/data-and-platform-administration/parsing-and-xql.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
