> 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-xsiam/configure-cortex-xsiam/data-management/parsing-rules/parsing-rules-file-structure-and-syntax/ingest/parse_cef.md).

# parse\_cef

### Syntax

```
parse_cef()
```

### Description

The `parse_cef()` function processes a CEF string and returns an object whose structure (key and\
value pairs) is determined by the input parameters.

### Example: Parsing CEF logs during ingestion

The following example demonstrates how to use the `parse_cef` function within a parsing rule to process raw logs and store the resulting object in a specific dataset. This logic is configured in the `INGEST` section to execute as data is written to Cortex XSIAM.

```
[INGEST:vendor="test", product="parse_cef", target_dataset="test_parse_cef_raw", no_hit = keep]
alter raw ="<14>Oct  2 10:06:18 PAN-PROD-APPSVC-EU-W4-FW01 CEF:0|Palo Alto Networks|PAN-OS|8.1.15-h3|end|TRAFFIC|1|rt=Oct 02 2022 17:06:18 GMT src=35.204.254.72 app=ssl proto=TCP in=8697 double=1.15 mac=B3-F5-10-ED-C4-EE ad.vd=root ad.subtype=forward pattern:test=test"
| alter parsed = parse_cef(raw)
| fields parsed;
```

#### Explanation of the rule components:

* `INGEST` section: Defines the `vendor`, `product`, and the `target_dataset` where the parsed logs will be stored.
* `alter raw`: In this rule context, this defines the source string to be parsed (simulating the `_raw_log` input).
* `parse_cef(raw)`: Processes the CEF string into a structured object containing key-value pairs.
* Semicolon (`;`): Required at the end of the rule to ensure proper compilation.

### Output results

The following JSON represents the structured object stored in the parsed field of the `test_parse_cef_raw` dataset after the rule is applied:<br>

```
"parsed": {
"ad.subtype": "forward",
"ad.vd": "root",
"app": "ssl",
"cefDeviceEventClassId": "end",
"cefDeviceProduct": "PAN-OS",
"cefDeviceVendor": "Palo Alto Networks",
"cefDeviceVersion": "8.1.15-h3",
"cefName": "TRAFFIC",
"cefSeverity": "1",
"cefVersion": "CEF:0",
"double": "1.15",
"in": "8697",
"mac": "B3-F5-10-ED-C4-EE",
"pattern:test": "test",
"proto": "6",
"rt": 1664730378000,
"src": "35.204.254.72"
}
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-xsiam/configure-cortex-xsiam/data-management/parsing-rules/parsing-rules-file-structure-and-syntax/ingest/parse_cef.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
