πŸ›‘οΈ Audit records
The audit log tracks key activities that occur within the Atlassian organization. Use these activities to diagnose problems or questions related to user details, product access, managed accounts, and organization settings.
This resource represents audits that record activities undertaken in Jira. Use it to get a list of audit records.
Tip: The audit log includes activities for up to 180 days. To save activities before they pass 180 days, export the audit log periodically.
  • πŸ—‘οΈ Product audit logs: Audit logs already exist in Jira Software Cloud and Confluence Cloud. Refer to the table to understand the different types of activities you can find in each audit log.
​
  • 🏹 Access audit log activities: The audit log includes these types of activities.

View the audit log

To access your organization's audit log, you must be an organization admin. From your organization at admin.atlassian.com, select Security and then Audit log.
You’ll see a table of activities, organized by the date and time the activity happened, the actor who took the action, and the action itself.
Atlassian Audit Log
​

Get audit records

Returns a list of audit records.
1
package main
2
​
3
import (
4
"context"
5
"github.com/ctreminiom/go-atlassian/jira/v3"
6
"log"
7
"os"
8
"time"
9
)
10
​
11
func main() {
12
​
13
var (
14
host = os.Getenv("HOST")
15
mail = os.Getenv("MAIL")
16
token = os.Getenv("TOKEN")
17
)
18
​
19
jiraCloud, err := v3.New(nil, host)
20
if err != nil {
21
return
22
}
23
​
24
jiraCloud.Auth.SetBasicAuth(mail, token)
25
jiraCloud.Auth.SetUserAgent("curl/7.54.0")
26
​
27
auditRecordOption := &v3.AuditRecordGetOptions{
28
​
29
//Filter the records by a word, in that case, the custom field history
30
Filter: "",
31
​
32
//Filter the records by the last month
33
From: time.Now().AddDate(0, -1, 0),
34
​
35
// Today
36
To: time.Now(),
37
}
38
​
39
auditRecords, response, err := jiraCloud.Audit.Get(context.Background(), auditRecordOption, 0, 500)
40
if err != nil {
41
if response != nil {
42
log.Println("Response HTTP Response", response.Bytes.String())
43
}
44
log.Fatal(err)
45
}
46
​
47
log.Println("Response HTTP Code", response.Code)
48
log.Println("HTTP Endpoint Used", response.Endpoint)
49
​
50
for _, record := range auditRecords.Records {
51
​
52
log.Printf("Record ID: %v", record.ID)
53
log.Printf("Record Category: %v", record.Category)
54
log.Printf("Record Created: %v", record.Created)
55
log.Printf("Record RemoteAddress: %v", record.RemoteAddress)
56
log.Printf("Record Summary: %v", record.Summary)
57
log.Printf("Record AuthorKey: %v", record.AuthorKey)
58
log.Printf("\n")
59
}
60
​
61
}
62
​
Copied!
πŸ§šβ€β™€οΈ Tips: You can extract the following struct tags
1
type AuditRecordPageScheme struct {
2
Offset int `json:"offset,omitempty"`
3
Limit int `json:"limit,omitempty"`
4
Total int `json:"total,omitempty"`
5
Records []*AuditRecordScheme `json:"records,omitempty"`
6
}
7
​
8
type AuditRecordScheme struct {
9
ID int `json:"id,omitempty"`
10
Summary string `json:"summary,omitempty"`
11
RemoteAddress string `json:"remoteAddress,omitempty"`
12
AuthorKey string `json:"authorKey,omitempty"`
13
Created string `json:"created,omitempty"`
14
Category string `json:"category,omitempty"`
15
EventSource string `json:"eventSource,omitempty"`
16
Description string `json:"description,omitempty"`
17
ObjectItem *AuditRecordObjectItemScheme `json:"objectItem,omitempty"`
18
ChangedValues []*AuditRecordChangedValueScheme `json:"changedValues,omitempty"`
19
AssociatedItems []*AuditRecordAssociatedItemScheme `json:"associatedItems,omitempty"`
20
}
21
​
22
type AuditRecordObjectItemScheme struct {
23
ID string `json:"id,omitempty"`
24
Name string `json:"name,omitempty"`
25
TypeName string `json:"typeName,omitempty"`
26
ParentID string `json:"parentId,omitempty"`
27
ParentName string `json:"parentName,omitempty"`
28
}
29
​
30
type AuditRecordChangedValueScheme struct {
31
FieldName string `json:"fieldName,omitempty"`
32
ChangedFrom string `json:"changedFrom,omitempty"`
33
ChangedTo string `json:"changedTo,omitempty"`
34
}
35
​
36
type AuditRecordAssociatedItemScheme struct {
37
ID string `json:"id,omitempty"`
38
Name string `json:"name,omitempty"`
39
TypeName string `json:"typeName,omitempty"`
40
ParentID string `json:"parentId,omitempty"`
41
ParentName string `json:"parentName,omitempty"`
42
}
Copied!
Export as PDF
Copy link