* feat(audit): record tag changes in the audit log Graph publishes TagsAdded and TagsRemoved on every tag assign and unassign, but only the search service listened, so a tag change left no trace in the audit log. The audit service now registers both events and logs them as file_tags_add and file_tags_remove, with the acting user (Executant), the space owner, the file id and path, and the comma-separated tags. Graph sets the Timestamp on both events, which it left unset. Two test cases use different owner and actor ids; the audit README documents the two actions. Fixes #13054 Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Paul Faure <paul@faure.ca> * fix(audit): record only the tags that actually changed; skip no-op tag events Review follow-up for #13055: - graph: TagsAdded/TagsRemoved now carry the tags that were actually added or removed (requesting an existing tag, or removing an absent one, is not a change). Search only uses the event's Ref, so it is unaffected. - audit: skip tag events whose tag list is empty. Graph still publishes TagsRemoved for search when nothing was present; that is not an audit event. - audit: document why User is the executant for tag events; describe Tags as carried by the event; remove a stray copy-pasted doc comment. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpoeSoKYEdgQcWjEzTVKpT Signed-off-by: Paul Faure <paul@faure.ca> * fix(audit): carry the requested tags in tag events, as before Per review: TagsAdded/TagsRemoved go back to carrying the tags as requested, and the audit log records every request, including tags that were already present (or absent, for a removal), so repeated requests stay visible. Computing the actual delta belongs in the tags package, not here. Removes the graph-side tagsDiff helper and its test, and the audit service's skip for empty tag lists. The other review fixes stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpoeSoKYEdgQcWjEzTVKpT Signed-off-by: Paul Faure <paul@faure.ca> --------- Signed-off-by: Paul Faure <paul@faure.ca> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
33 lines
2.0 KiB
Markdown
33 lines
2.0 KiB
Markdown
# Audit
|
|
|
|
The audit service logs all events of the system as an audit log. Per default, it will be logged to standard out, but can also be configured to a file output. Supported log formats are json or a minimal human-readable format.
|
|
|
|
Besides shares, links, files, spaces, users and groups, tag changes are recorded: adding tags to a file or folder is logged as `file_tags_add` and removing them as `file_tags_remove`, each with the acting user, the file id and the tags as requested. The request is recorded as made: a tag that was already present (or, for a removal, absent) is still listed, so repeated requests remain visible.
|
|
|
|
With audit logs, you are able to prove compliance with corporate guidelines as well as to enable reporting and auditing of operations. The audit service takes note of actions conducted by users and administrators.
|
|
|
|
Example minimal format:
|
|
```
|
|
file_delete)
|
|
user 'user_id' trashed file 'item_id'
|
|
file_trash_delete)
|
|
user 'user_id' removed file 'item_id' from trashbin
|
|
```
|
|
|
|
Example json:
|
|
```
|
|
{"RemoteAddr":"","User":"user_id","URL":"","Method":"","UserAgent":"","Time":"","App":"admin_audit","Message":"user 'user_id' trashed file 'item_id'","Action":"file_delete","CLI":false,"Level":1,"Path":"path","Owner":"user_id","FileID":"item_id"}
|
|
{"RemoteAddr":"","User":"user_id","URL":"","Method":"","UserAgent":"","Time":"","App":"admin_audit","Message":"user 'user_id' removed file 'item_id' from trashbin","Action":"file_trash_delete","CLI":false,"Level":1,"Path":"path","Owner":"user_id","FileID":"item_id"}
|
|
```
|
|
|
|
The audit service is not started automatically when running as single binary started via `ocis server` or when running as docker container and must be started and stopped manually on demand.
|
|
|
|
The audit service logs:
|
|
|
|
- File system operations
|
|
(create/delete/move; including actions on the trash bin and versioning)
|
|
- User management operations
|
|
(creation/deletion of users)
|
|
- Sharing operations
|
|
(user/group sharing, sharing via link, changing permissions, calls to sharing API from clients)
|