When to Use
- Incident log attachment: When a P1 incident issue is created, a workflow collects the last 500 lines of the failing service's log, saves it to a temp file, and attaches it to the Jira issue. Engineers opening the issue immediately have the relevant log without searching log aggregators.
- Test report attachment: After a CI/CD test run, the pipeline workflow attaches the HTML test report and JUnit XML results to the linked story, giving QA engineers direct access to the full test output without leaving Jira.
- Screenshot evidence: A UI monitoring tool captures screenshots of rendering errors. A workflow attaches the screenshot PNG to the corresponding Jira bug, providing visual evidence that would otherwise require manual attachment.
- Compliance document filing: When a change request is approved, the signed approval document (PDF) is automatically attached to the Jira change request task to satisfy audit trail requirements that demand physical document evidence.
- Performance report distribution: After a weekly load test, a workflow generates a PDF performance report and attaches it to the relevant performance tracking issue in Jira, making historical reports searchable and co-located with the issue history.
Configuration
Connection
| Field | Required | Description |
Host | Required | Jira instance base URL. Example: https://acmecorp.atlassian.net |
Email | Required | Atlassian account email. Example: automation@acmecorp.com |
ApiToken | Required | API token from Atlassian security settings. Store in Credentials Manager. |
Operation Fields
| Field | Required | Description |
IssueKey | Required | The key of the issue to attach the file to. Example: OPS-347. |
FilePath | Required | Absolute path to the file on the workflow server's filesystem. Example: /tmp/incident-logs-2026-05-26.txt. The file must be accessible to the workflow engine process. |
FileName | Optional | Override the file name shown in Jira. If omitted, the actual file name from FilePath is used. Use this to give attachments meaningful names: incident-OPS-347-logs-2026-05-26.txt. |
File size limit: Jira Cloud supports attachments up to 10MB by default (configurable by Jira admins). For larger files such as heap dumps or full log archives, consider uploading to S3 or a cloud store and attaching only a link in a comment.
Sample Configuration
Attach a generated incident log file to a Jira issue:
{
"resource": "attachment",
"operation": "add",
"Host": "https://acmecorp.atlassian.net",
"Email": "automation@acmecorp.com",
"ApiToken": "{{ $credentials.jiraApiToken }}",
"IssueKey": "{{ $json.issueKey }}",
"FilePath": "{{ $json.logFilePath }}",
"FileName": "incident-{{ $json.issueKey }}-logs-{{ $now | date('YYYY-MM-DD-HHmm') }}.txt"
}
Validation Errors
| Error Code | Cause |
VAL_MISSING_ISSUE_KEY | IssueKey is empty or null. |
VAL_MISSING_FILE_PATH | FilePath is empty or null. |
FILE_NOT_FOUND | The file at FilePath does not exist or is not readable by the workflow engine. |
FILE_TOO_LARGE | File exceeds the Jira instance's attachment size limit. |
ISSUE_NOT_FOUND | No issue exists with the given key, or the user lacks access. |
AUTH_FAILED | Invalid credentials or expired API token. |
Output Fields
| Field | Type | Description |
status | string | "success" or "error" |
attachmentId | string | Internal Jira attachment ID. Store this if you need to retrieve or delete the attachment later. |
issueKey | string | Key of the issue the file was attached to. |
fileName | string | File name as stored in Jira (the overridden name if FileName was set). |
fileSize | integer | File size in bytes. |
resource | string | Always "attachment" |
operation | string | Always "add" |
Sample Output
{
"status": "success",
"attachmentId": "10044",
"issueKey": "OPS-347",
"fileName": "incident-OPS-347-logs-2026-05-26-1430.txt",
"fileSize": 48312,
"resource": "attachment",
"operation": "add"
}
Expression Reference
| Expression | Type | Example Value | Use |
{{ $output.addAttachment.attachmentId }} | string | "10044" | Store for later retrieval or deletion |
{{ $output.addAttachment.fileName }} | string | Stored file name | Confirm file name in post-attach comment |
{{ $output.addAttachment.fileSize }} | integer | 48312 | Log file size for audit records |
Node Policies & GuardRails
- Use meaningful file names: Always supply
FileName with a descriptive name including the issue key and date. Generic names like output.txt are unhelpful when multiple attachments accumulate on an issue.
- Clean up temp files: After successfully uploading, delete the temp file from the server filesystem to avoid disk accumulation. Use a Function node or OS command after the attachment step.
- Sensitive file content: Never attach files containing passwords, private keys, or full customer PII. Redact sensitive content before generating the attachment file.
- Large files use S3 instead: For files over 5MB, upload to S3 (or another object store) and add a comment with the S3 URL instead of attaching directly to Jira.
Workflow Examples
Example 1 — Attach Incident Logs to P1 Bug
// Step 1: issue/create — create P1 bug, get issueKey
// Step 2: Function node — collect recent log lines, write to /tmp/
// Step 3: attachment/add
{
"resource": "attachment",
"operation": "add",
"IssueKey": "{{ $output.createIssue.issueKey }}",
"FilePath": "/tmp/service-logs-{{ $now | date('YYYYMMDDHHmm') }}.txt",
"FileName": "{{ $output.createIssue.issueKey }}-logs.txt"
}
// Step 4: comment/add — reference the attachment in the issue comment
Example 2 — Attach Test Report After CI Run
// Post-CI pipeline webhook triggers with test results path
{
"resource": "attachment",
"operation": "add",
"IssueKey": "{{ $json.jiraStoryKey }}",
"FilePath": "{{ $json.testReportPath }}",
"FileName": "test-report-{{ $json.buildNumber }}-{{ $now | date('YYYY-MM-DD') }}.html"
}