> 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/xsoar-6-administrator-guide/6.12/configure-cortex-xsoar/customize-and-configure-cortex-xsoar/incidents/pre-process-rules.md).

# Pre-Process Rules

Pre-Process rules enable you to perform certain actions on incidents as soon as they are ingested into Cortex XSOAR directly from the user interface. Through these rules, you can select incoming events on which to perform actions, for example, link the incoming incident to an existing incident, or under pre-configured conditions, drop the incoming incident altogether.

You can de-duplicate incidents by selecting the **Link and Close** action in the **Pre-Process Rules** tab. To create a pre-process rule, see [Create Pre-Process Rules for Incidents](#UUID-e49e2cac-8f6f-17d7-51fc-b69b438ccd7c). After you create a pre-process rule, in the **Pre-Process Rules** tab, you can do the following:

* View, edit, copy, or delete the Pre-Process Rule.
* Enable/disable the Pre-Process Rule.

The **Link and Close** action creates an entry in the Linked Incidents table of the existing incident to which you link, and closes the incoming incident. If an existing incident matching the defining criteria is not found an incident is created for the incoming event.

For troubleshooting, you might need to identify which pre-process rule was triggered. To store pre-process logs in a separate file, go to Settings → About → Troubleshooting → **Add Server Configuration** and add **`preprocess.logs.file`** with the value **`true`**.

### **Create Pre-Process Rules for Incidents**

Pre-processing rules enable you to perform certain actions on incidents as they are ingested into Cortex XSOAR. You can, for example, link an incoming incident to an existing incident, or under certain conditions, drop the incoming incident altogether.

{% hint style="info" %}

### Note

Rules are applied in descending order, and only one rule is applied per incident.
{% endhint %}

1. Select Settings → OBJECTS SETUP → **Incidents** → Pre-Process Rules → **New Rule**.
2. In the **Rule Name** field, type a name for the rule.

   Give a meaningful name that helps you identify what the rule does. This will be useful when viewing the list of rules.
3. If you want the rule to apply to a specific incident, in the **Conditions for Incoming incident** section, click **Add filter** and set the incident field and value.

   For example, if you are running a phishing awareness campaign, you can create a rule for the email subject.

   You can add multiple conditions within a filter and add multiple filters. For more information about filters, see [Filter Operators](/xsoar-6-administrator-guide/6.12/configure-cortex-xsoar/customize-and-configure-cortex-xsoar/playbooks/filters-and-transformers.md#UUID-c414dab8-037a-6093-060d-f87af4b6eff7).
4. In the **Action** section, from the drop-down list determine which action to take if the incoming incident matches the rule.
5. Depending on the Action field, complete section **3.**

   For example, in the **Action** field, if you select **Drop and update**, in section **3**, complete the **Update** field.

   Section 3 enables you to link to an incoming event and update the incident depending on the selected filter. For information about the **Action** section and the fields in section **3**, see [Rule Actions for Pre-Process Rules](#UUID-6a36e6c3-bff9-e119-6dfd-5626e610543e).
6. (Multi-tenant) From the dropdown list, select the [propagation label](https://app.gitbook.com/s/w0Gnt3LmZ1hd1u9rTUNQ/manage-content/add-propagation-labels-to-content). When syncing from the main account to the tenant, the pre-processing rule is sent to the tenant based on the propagation label.
7. (Optional) In a remote repository or in a multi-tenant environment, you can view the relevant dependencies to ensure that all necessary dependencies are propagated or pushed to the remote repository.
8. (Optional) To check that the rules are effective and efficient, click **Test**.

   Testing is useful to check that you are receiving the desired results before putting a rule into production. We recommend you fetch data from an existing incident as a sample incident against which the rule can run. You can also manually enter JSON to use as a test sample or edit the JSON from an existing incident using the **Edit** button.
9. Click **Save**.

<details>

<summary>Pre-process rules examples</summary>

Drop incidents

When you run a phishing awareness campaign and send training emails to your employees, you want your employees to report the emails but you don't want to investigate. In this example, we create a condition for incoming incidents with the email subject You've Won the Best Employee Award, and drop those incidents without linking them to another incident.

![preProcessing.png](/files/2Vr89jZSyRk2CVu2QKp6)

Drop and update incidents

In this example, you want a pre-process rule to do the following:

* Apply to incidents that are ingested from the Sample Incident Generator.
* Drop incoming events and update the incident, if the name of the existing incident is identical to the incoming incident.

  You can add multiple conditionals to check for duplicates (not just the incident name) such as a Threat ID, incident ID, email, and host.

1. Create a pre-process rule.

   ![pre-process-rule-6.png](/files/bfSQbeJTtVfNcJzoMzxJ)
2. (Optional) Go to an incident and check the Context Data.

   You can see that 43,222 duplicate incidents have been dropped, as seen in the original incident.

   ![pre-process-context-6.png](/files/1NJWY3IxExUgDmI4Y9kp)

   In the incident table, you can also see the number of dropped incidents.

   ![pre-process-table.png](/files/DpQZlUOz5WESrUa57QdH)

   In the dashboard:

   ![pre-process-dash.png](/files/tMBfUcYLsDpAmtTXMiRs)

</details>

### **Rule Actions for Pre-Process Rules**

The following table describes the rule actions for pre-process rules.

| Option          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Section 3                                                                                                                                                                                                           |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Drop            | Drops the incoming incident and no incident is created.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | None                                                                                                                                                                                                                |
| Close           | Closes the incoming incident.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | None                                                                                                                                                                                                                |
| Drop and update | Drops the incoming event, and updates the Dropped Duplicate Incidents table of the existing incident that you define. In addition, a War Room entry is created. If an existing incident matching the defined criteria is not found, an incident is created for the incoming event.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | <p><strong>Update</strong></p><p>1. Determine if you want to update the newest or oldest incident within a time range.</p><p>2. Select the incident you want to update together with the value.</p>                 |
| Link            | Creates an entry in the Linked Incidents table of the existing incident to which you link.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | <p><strong>Link to</strong></p><p>1. Determine if you want to link to the oldest or newest incident within a time range.</p><p>2. Select the incident you want to update together with the value.</p>               |
| Link and close  | Creates an entry in the Linked Incidents table of the existing incident to which you link, and closes the incoming incident. If an existing incident matching the defined criteria is not found, an incident is created for the incoming event.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | <p><strong>Link to</strong></p><p>1. Determine if you want to link to the oldest or newest incident within a time range.</p><p>2. Select the incident you want to update together with the value.</p>               |
| Run a script    | <p>Select an automation to run on the incoming incident. When you create a script, you need to add the <strong>preProcessing</strong> tag for the script to appear in the list of available scripts.</p><div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>Note</strong></p><p>Pre-Process rules that use system-based automations such as <strong><code>GetIncidentsByQuery</code></strong>, by default, are run according to the defined role (<strong>Limited User</strong>). For example, if the <strong><code>GetIncidentsByQuery</code></strong> automation runs with the <strong>Limited User</strong> role, it also runs with the <strong>Limited User</strong> role in the Pre-Process rule. You can change the default by either detaching the automation and updating the <strong>RunAs</strong> field such as <strong>DbotRole</strong>, or create a wrapper automation with the required role set in the <strong>RunAs</strong> field. The wrapper automation calls the system-based automation. The system-based when called by the wrapper automation runs with the role assigned to the wrapper automation.</p></div><p>Pre-processing automations can access sensitive incident data. As best practice, we recommend assigning a Role for the pre-processing script to allow only trusted users to edit it.</p> | <p><strong>Choose a script</strong></p><p>From the dropdown list, select the script to run on the incoming incident. Only scripts that were tagged <strong>preProcessing</strong> appear in the drop-down list.</p> |


---

# 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/xsoar-6-administrator-guide/6.12/configure-cortex-xsoar/customize-and-configure-cortex-xsoar/incidents/pre-process-rules.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.
