Audit Log
Since Gitea 1.28 the audit log is part of the open source edition, and Gitea Enterprise builds on it. Everything the open source audit log offers (the audit event model, the [audit] settings and the recorded actions) works the same way in Gitea Enterprise. This page only describes what Gitea Enterprise adds or does differently. For the shared part, see the audit log documentation of the open source edition.
Differences from the open source edition
Section titled “Differences from the open source edition”| Open source | Gitea Enterprise | |
|---|---|---|
Default of [audit].RECORD_OUTPUT |
disabled |
database, recording is on out of the box |
Default of [audit].RETENTION_DAYS |
30 |
0, records are kept forever |
| Recorded actions | Community actions | Open source actions plus the actions listed below |
The audit pages of users, organizations and repositories, the action, origin and actor filters and the JSONL export of the admin page are part of the open source edition as well. Gitea Enterprise adds the admin API, CSV export and the keyword and time range filters of the API.
RECORD_OUTPUT, RETENTION_DAYS and RECORD_PUSH_PULL_FILE_NAMES are set in the [audit] section of app.ini. RECORD_PUSH_PULL_FILE_NAMES (default false) also records the file names of each push and pull, which costs an extra git command per push and pull and grows each record by up to a few KB.
Pruning runs in the delete_old_audit_events cron task once a day. It is registered only while RETENTION_DAYS is above 0, so an upgrade never deletes history by itself.
Where the log is exposed
Section titled “Where the log is exposed”| Page | Who can see it | Contents |
|---|---|---|
Site Administration > Audit Log (/-/admin/audit-logs) |
Site administrators | Every record |
/user/settings/audit-logs |
The signed-in user | Records scoped to their account |
/org/{org}/settings/audit-logs |
Organization owners | Records scoped to the organization |
/{owner}/{repo}/settings/audit-logs |
Repository administrators | Records scoped to the repository |
A scoped page never shows the records of another entity. The admin API is available at /api/v1/admin/audit-logs and /api/v1/admin/audit-logs/export.
The operation filter takes an action such as repository:label:create, or the start of an action such as repository:label or repository, and selects every action below it. The admin API filters by operator_id, action, q, start_unix and end_unix.
Record fields
Section titled “Record fields”| Field | Meaning |
|---|---|
action |
What happened, for example repository:archive. |
operation_type |
Deprecated, use action. It has the same value as action. |
operator_id / operator_name |
Who did it. An unauthenticated request is recorded as anonymous, the CLI as (gitea-cli) and authentication source syncs as (gitea-auth-source). |
scope_type / scope_id / scope_name |
The entity the record is listed under: system, user, organization or repository. |
origin |
How the operation reached Gitea: ui, api, cli or system (cron tasks, git hooks, the internal API). |
ip_address |
The client address, when the operation came through a request. |
Actions only Gitea Enterprise records
Section titled “Actions only Gitea Enterprise records”These actions are recorded by Gitea Enterprise only. All other actions are shared with the open source edition.
accesstoken:approveaccesstoken:disableaccesstoken:enableaccesstoken:expiry:changeaccesstoken:leak:revokeaccesstoken:rejectaccesstoken:revokeagent:command:denyagent:createagent:deliveryplan:approveagent:deliveryplan:cancelagent:deliveryplan:markdoneagent:deliveryplan:pauseagent:deliveryplan:resumeagent:deliveryplan:submitagent:deliverystep:retryagent:task:createagent:updateissue:comment:updateissue:lockissue:status:closeissue:status:reopenissue:unlockissue:updateorganization:accesstoken:approval:autograntorganization:branch:protection:addorganization:branch:protection:removeorganization:branch:protection:updateorganization:label:createorganization:label:deleteorganization:label:updateorganization:member:addorganization:member:updateorganization:oauth2application:grantorganization:settings:updatepackage:createpackage:deletepackage:downloadpackage:uploadpr:review:submitpr:reviewrequest:addpr:reviewrequest:removepr:targetbranch:updatepr:wip:addpr:wip:removeproject:closeproject:reopenrepository:archive:downloadrepository:avatar:removerepository:avatar:updaterepository:branch:checkoutrepository:branch:deleterepository:branch:mergerepository:file:downloadrepository:git:clonerepository:git:pullrepository:git:pushrepository:git:ref:createrepository:git:ref:deleterepository:label:createrepository:label:deleterepository:label:updaterepository:milestone:createrepository:milestone:deleterepository:milestone:updaterepository:mirror:push:updaterepository:pushprotection:blockrepository:pushprotection:bypassrepository:pushprotection:reportrepository:pushrule:exemptrepository:pushrule:updaterepository:reference:updaterepository:release:createrepository:release:deleterepository:release:updaterepository:security:scanrepository:securityscan:branch:updaterepository:securityscan:cleanuprepository:securityscan:disablerepository:securityscan:enablerepository:settings:updatesystem:announcement:updatesystem:license:activatesystem:license:removesystem:license:updatesystem:maintenance:runsystem:package:cleanupsystem:repository:adoptsystem:settings:auth:updatesystem:settings:cache:updatesystem:settings:mailer:updatesystem:settings:session:updatesystem:settings:storage:updatesystem:settings:updatesystem:webhook:default:addsystem:webhook:default:removesystem:webhook:default:updateuser:authentication:failuser:authentication:logoutuser:authentication:successuser:update
Exporting audit logs
Section titled “Exporting audit logs”Site administrators can export the records matching the current filters, from Site Administration > Audit Log or with GET /admin/audit-logs/export:
- CSV (default): a spreadsheet friendly table. The web download starts with a UTF-8 byte-order mark so Microsoft Excel opens it correctly; the API response omits it.
- JSONL (
?format=jsonl): one JSON object per line, in the shape of the open source audit event, for log collectors.
Upgrading from Gitea Enterprise 27
Section titled “Upgrading from Gitea Enterprise 27”- Records move from the
ee_audit_logtable to theaudit_eventtable of the open source edition. The conversion runs as a migration, in batches that resume if the upgrade is interrupted, and no record is skipped. The old table is kept, apart from pruning byRETENTION_DAYS, and can be dropped once you have checked the result. - Records written before the upgrade have the origin
unknown, because the UI and the API were not told apart before. operation_typeof the admin audit API and of the export now has the value ofaction(for exampleuser:authentication:successinstead ofuser:sign_in). Readaction. The old names still work as a filter and are kept aslegacy_operation_typein the record metadata.- Closing and reopening a project are recorded as
project:closeandproject:reopen, they wereproject:update. - Recording stays on after the upgrade unless
RECORD_OUTPUTis set todisabled.