Attachments
Attachments are supported in sentry-go
version 0.23.0
and above.
Sentry can enrich your events for further investigation by storing additional files, such as config or log files, as attachments.
Uploading Attachments
Attachments live on the Scope
and will be sent with all events.
sentry.ConfigureScope(func(scope *sentry.Scope) {
// Add an attachment
scope.AddAttachment(&Attachment{
Filename: "report.html",
ContentType: "text/html",
Payload: []byte("<h1>Look, HTML</h1>"),
})
})
An attachment has the following fields:
Filename
- The filename that will be displayed in sentry.io.
Payload
- The content of the attachment in bytes.
ContentType
- (Optional) The type of content stored in this attachment. Any MIME type may be used.
Sentry allows at most 20MB for a compressed request, and at most 100MB of uncompressed attachments per event, including the crash report file (if applicable). Uploads exceeding this size are rejected with HTTP error 413 Payload Too Large
and the data is dropped immediately. To add larger or more files, consider secondary storage options.
Attachments persist for 30 days; if your total storage included in your
Learn more about how attachments impact your quota.
Access to Attachments
To limit access to attachments, navigate to your organization's General Settings, then select the Attachments Access dropdown to set appropriate access — any member of your organization, the organization billing owner, member, admin, manager, or owner.
By default, access is granted to all members when storage is enabled. If a member does not have access to the
Viewing Attachments
Attachments display on the bottom of the Issue Details page for the event that is shown.
Alternately, attachments also appear in the Attachments tab on the Issue Details page, where you can view the Type of attachment, as well as associated events. Click the Event ID to open the Issue Details of that specific event.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
- Package:
- github:getsentry/sentry-go
- Version:
- 0.25.0
- Repository:
- https://github.com/getsentry/sentry-go/
- API Documentation:
- https://pkg.go.dev/github.com/getsentry/sentry-go