Custom actions turn values from a log or span into clickable jumps to Coralogix screens, internal tools, dashboards, or third-party services. Define a URL template once with placeholders that pull fields from the selected log or span, then trigger the action from any matching record to open the destination with the right context already filled in. No more manual copy-paste between tools.

## What you need

To create actions, you need permission to manage actions in your Coralogix account and a dataset that contains the fields you plan to inject into URLs. To trigger an action, the destination must accept browser navigation. Most in-product routes and third-party web apps qualify.

## Open the Actions panel

1. Go to **Explore**, then select **Logs** or **Spans**.
1. Select the more actions menu, then select **Manage actions**.

The Actions panel opens on the right with two sections:

- **Private**: actions only you can see and use.
- **Shared**: actions created by you or others that are visible to the team.

## Create an action

1. From the Actions panel, select **Add new action**.
1. Fill in the form:
   - **Name**: the label shown in the action menu and catalog.
   - **URL template**: the destination URL with `{{...}}` placeholders that pull fields from the selected log or span. URLs must start with `http://` or `https://`.
   - **Description**: a short note explaining when to use the action.
   - **Filters**: narrow when the action appears by application, subsystem, or other attributes. Toggle **Exact match** to require an exact value match on every filter.
   - **Access**: **Private** keeps the action to your account, and **Shared** makes it visible to teammates under the **Shared** section of the catalog.
1. Select **Save**.

The action appears in the catalog and is immediately available wherever its filters and data type apply.

## URL template variables

Use double curly braces (`{{ }}`) anywhere in the URL template. Three variable namespaces are available:

| Variable | What it resolves to                                                                              | Example                                                                                 |
| -------- | ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- |
| `$d`     | Fields from the selected log or span, including nested paths.                                    | `{{$d.trace_id}}`, `{{$d.log_str.span_id}}`                                             |
| `$m`     | Coralogix metadata fields attached to the log or span.                                           | `{{$m.applicationName}}`, `{{$m.subsystemName}}`, `{{$m.severity}}`, `{{$m.timestamp}}` |
| `$l`     | Span fields, available only when the active dataset is `spans`.                                  | `{{$l.span_id}}`, `{{$l.trace_id}}`, `{{$l.service.name}}`                              |
| `$p`     | Page and query context. Values from the current Explore session and the value the user selected. | `{{$p.start_date}}`, `{{$p.end_date}}`, `{{$p.selected_value}}`                         |

Use `$p.selected_value` when the action should pass the specific value the user selects. Actions that include `$p.selected_value` only appear in the value menu, not in the row-level menu.

Selected values are URL-encoded (`encodeURIComponent`) before substitution, so values that contain spaces, slashes, or other reserved characters reach the destination intact. Resolved URLs open in a new browser tab with `noopener` and `noreferrer` set on the link.

### JavaScript expressions

Anything inside `{{ }}` is evaluated as a JavaScript expression. You can branch on field values, build composite strings, or call standard JavaScript functions:

```javascript
https://example.com/?env={{ $m.subsystemName === "frontend" ? "Front" : "Back" }}
```

### Bracket notation for special characters

For field names that contain hyphens, spaces, or that start with a digit, use bracket notation instead of dot notation:

```javascript
https://example.com/?id={{$d["order-id"]}}&user={{$d["123_user"]}}
```

## Trigger an action

After saving, an action becomes available wherever its **Data type** and **Filters** match the current log or span.

1. Run a query in Explore so the grid contains the log or span you want to act on.
1. Open the action menu in one of two ways:
   - **From a row**: open the more actions menu next to the row. Only actions that do not use `{{$p.selected_value}}` appear here.
   - **From an attribute value**: select the value of any field in the log or span. The cell menu shows **Custom Actions** with a submenu of every matching action. `{{$p.selected_value}}` resolves to the selected value.
1. In the Custom Actions submenu:
   - Use the search box to find an action by name.
   - Switch between the **All**, **Private**, and **Shared** tabs to filter by access scope.
   - Select **Manage actions** at the bottom to open the Actions panel and create or edit actions.
1. Select the action. The destination URL opens in a new browser tab with all placeholders replaced.

An action is only listed when every placeholder in its URL template resolves from the current row data. Actions with unresolved placeholders are hidden from the submenu — there is no greyed-out state. If you expect an action to appear and it doesn't, check that the row contains all the fields the URL template references.

## Example URL templates

Authoring an action follows the same shape every time. Take the destination URL, replace each dynamic value with `{{$d.field}}`, `{{$m.field}}`, or `{{$p.selected_value}}`, paste the result into **URL template**, give the action a name, and save. The same recipe handles a Coralogix screen, a Grafana board, and a Jira ticket. Only the destination URL changes.

The recipes below cover the most common workflows. Replace the angle-bracketed placeholders (`<team>`, `<your-domain>`, and so on) with values from your account, and adjust the field names to match your log shape.

**Open the related trace.** Jump from a log to its trace, with the time window centered on the log's timestamp. Best when the log carries a `trace_id`.

```javascript
https://<team>.coralogix.com/#/tracing/{{$d.trace_id}}?start={{$m.timestamp*1000 - 3000000000}}&end={{$m.timestamp*1000 + 3000000000}}
```

**Pivot to a filtered logs query.** Open Explore filtered to logs that share a key with the current log, over the same time range.

```javascript
https://<team>.coralogix.com/#/explore/logs?queryType=lucene&query=<key>:"{{$d.<key>}}"&from={{$p.start_date}}&to={{$p.end_date}}
```

**Pivot from a log to its spans.** Open the Spans dataset filtered to the same `trace_id` as the current log.

```javascript
https://<team>.coralogix.com/#/explore/spans?queryType=lucene&query=trace_id:"{{$d.trace_id}}"&from={{$p.start_date}}&to={{$p.end_date}}
```

**Open a RUM session.** Move from a log carrying `session_id` to all events in that user's session.

```javascript
https://<team>.coralogix.com/#/explore/logs?queryType=lucene&query=cx_rum.session_context.session_id:"{{$d.session_id}}"
```

**Open a Grafana dashboard for the service.** Land on a Grafana board pre-filtered to the service that emitted the log.

```javascript
https://grafana.<your-domain>.com/d/<dashboard-id>/<dashboard-name>?var-service={{$m.subsystemName}}
```

**Create a Jira ticket pre-filled from the log.** Open the Jira issue-creation form with the summary and description populated from log fields.

```javascript
https://<your-atlassian-domain>.atlassian.net/secure/CreateIssueDetails!init.jspa?pid=<jira_pid>&issuetype=<jira_issue_type>&summary={{$d.msg}}&description={{$d.logRecord.body}}
```

**Search the web for the clicked value.** Look up an error string, identifier, or message from the log. Use `$p.selected_value` so the action only appears in the value menu and passes the exact clicked value.

```javascript
https://www.google.com/search?q={{$p.selected_value}}
```

**Branch the destination by environment.** Use a JavaScript ternary to send production logs to one URL and others to a different one.

```javascript
https://<team>.example.com/{{ $m.subsystemName === "prod" ? "prod-tools" : "staging-tools" }}/incident?id={{$d.incident_id}}
```

## Limitations

| Area                | Limit                                                                                                                                           |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| URL scheme          | Must start with `http://` or `https://`. Other schemes (`mailto:`, `slack:`, custom protocols) are not supported.                               |
| Triggering surface  | Actions trigger from individual log rows or attribute values. They are not available from chart visualizations, aggregations, or grouped views. |
| Value-aware actions | Actions that include `{{$p.selected_value}}` appear only in the attribute-value menu, not on the row-level menu.                                |
| Variables           | Only the `$d`, `$m`, and `$p` namespaces are supported. References to other namespaces are passed through literally and produce broken URLs.    |
| Authentication      | The destination opens in a new browser tab. The user must already be signed in to that destination. Actions cannot pass credentials.            |

## Troubleshoot

| Problem                                                   | Cause                                                                         | Resolution                                                                                                                         |
| --------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| The action does not appear on a log                       | The action's filters or data type exclude the current log.                    | Open the action and remove or adjust the filters. Confirm the log is from the right data type.                                     |
| The action only shows in the value menu, not the row menu | The URL template includes `{{$p.selected_value}}`.                            | Trigger the action by clicking an attribute value, or remove `$p.selected_value` from the template if you want a row-level action. |
| The opened URL has empty placeholders                     | The selected log does not contain the referenced field.                       | Add a filter to the action so it only appears on logs that include the field, or rewrite the template with a fallback expression.  |
| The action will not save                                  | The URL does not start with `http://` or `https://`.                          | Prefix the URL with the correct scheme.                                                                                            |
| A field with a hyphen renders as a JavaScript error       | Dot notation cannot reference fields with hyphens, spaces, or leading digits. | Use bracket notation: `{{$d["my-field"]}}`.                                                                                        |
| Teammates cannot see an action                            | The action's **Access** is set to **Private**.                                | Edit the action and switch **Access** to **Shared**.                                                                               |

## Related resources

- [Explore query parameters](https://coralogix.com/docs/user-guides/data_exploration/query-parameters/index.md)
- [Export data](https://coralogix.com/docs/user-guides/data_exploration/export/index.md)
- [Explore actions](https://coralogix.com/docs/user-guides/data_exploration/explore_actions/index.md)

## Support

Reach the Coralogix customer success team 24/7 via in-app chat or by email at [support@coralogix.com](mailto:support@coralogix.com).
