Extend context - Extend context to retrieve specific information from integrations or commands and map to fields. - Administrator Guide - Cortex XSIAM - Cortex - Security Operations

Cortex XSIAM Documentation

Product
Cortex XSIAM
Creation date
2024-03-06
Last date published
2025-12-14
Category
Administrator Guide
Abstract

Extend context to retrieve specific information from integrations or commands and map to fields.

By design, integrations do not write all of the data returned from a command to the context. This prevents large context size and enables you to store only the most relevant information.

Extend context enables you to save additional data from the raw response of a command. For example, when a command runs to retrieve events from a SIEM, only some of the event fields are written to context, according to the integration design. With extend context, you can save additional fields specific to your use case.

Extend context can also be used when the same command runs multiple times in the same playbook, but the outputs need to be saved to different context keys. For example, you can execute the !ad-get-user command twice, once to retrieve the user's information and again to retrieve the user's manager’s information. By default, an integration command writes the data from the same command to the same context key. By using extend context, you can write the command’s response to a custom context key of your choice.

You can extend context either in a playbook task or directly from the command line. Whichever method you use, first run your command with the raw-response=true flag. This enables viewing the full JSON output to identify what data you can extend into context, with the exact paths to the data.

Extend context in a playbook task
  1. In the Playground, run a command with raw response true to see all the data and data paths returned with the command.

    For example, in the Playground, run the !ad-get-user email=james.bond@xsoar.local raw-response=true command.

    extend-context-displayName.png
  2. Go to the Advanced tab of the relevant playbook task, such as a Data Collection task.

  3. In the Extend Context field, enter the name of the field in which you want the information to appear and the value you want to return.

    To include more than one field, separate the fields with a double colon. For example: attributes=displayName::manager=attributes.manager

  4. To output only the values for Extend context and ignore the standard output for the command, select the Ignore Outputs checkbox.

    While this will improve performance, only the values that you request in the Extend Context field are returned. You cannot use Field Mapping as there is no output to which to map the fields.

Extend context using the CLI
  1. Run your command with the extend-context flag !<commandName> <argumentName> <value>extend-context=contextKey=JsonOutputPath.

    For example, to add the user and manager fields to context use the ad-get-user command, as follows:

    !ad-get-user=${user.manager.username} extend-context=manager=attributes.manager::attributes=displayName

  2. To output only the values that you set as Extend context, run the command with the ignore-ouput flag=true. !ad-get-user=${user.manager.username} extend-context=manager=attributes.manager::attributes=displayName ignore-output=true