Merge branch 'master' into 14988-wb-rails5-upgrade
[arvados.git] / doc / admin / logs-table-management.html.textile.liquid
1 ---
2 layout: default
3 navsection: admin
4 title: "Logs table management"
5 ...
6
7 {% comment %}
8 Copyright (C) The Arvados Authors. All rights reserved.
9
10 SPDX-License-Identifier: CC-BY-SA-3.0
11 {% endcomment %}
12
13 This page aims to provide insight about managing the ever growing API Server's logs table.
14
15 h3. Logs table purpose & behavior
16
17 This database table currently serves three purposes:
18 * It's an audit log, permitting admins and users to look up the time and details of past changes to Arvados objects via @arvados.v1.logs.*@ endpoints.
19 * It's a mechanism for passing cache-invalidation events, used by websocket servers, the Python SDK "events" library, and @arvados-cwl-runner@ to detect when an object has changed.
20 * It's a staging area for stdout/stderr text coming from users' containers, permitting users to see what their containers are doing while they are still running (i.e., before those text files are written to Keep).
21
22 As a result, this table grows indefinitely, even on sites where policy does not require an audit log; making backups, migrations, and upgrades unnecessarily slow and painful.
23
24 h3. API Server configuration
25
26 To solve the problem mentioned above, the API server offers the possibility to limit the amount of log information stored on the table:
27
28 <pre>
29 # Time to keep audit logs (a row in the log table added each time an
30 # Arvados object is created, modified, or deleted) in the PostgreSQL
31 # database. Currently, websocket event notifications rely on audit
32 # logs, so this should not be set lower than 600 (10 minutes).
33 max_audit_log_age: 1209600
34 </pre>
35
36 ...and to prevent surprises and avoid bad database behavior (especially the first time the cleanup job runs on an existing cluster with a huge backlog) a maximum number of rows to delete in a single transaction.
37
38 <pre>
39 # Maximum number of log rows to delete in a single SQL transaction.
40 #
41 # If max_audit_log_delete_batch is 0, log entries will never be
42 # deleted by Arvados. Cleanup can be done by an external process
43 # without affecting any Arvados system processes, as long as very
44 # recent (<5 minutes old) logs are not deleted.
45 #
46 # 100000 is a reasonable batch size for most sites.
47 max_audit_log_delete_batch: 0
48 </pre>
49
50 This feature works when both settings are non-zero, periodically dispatching a background task that deletes all log rows older than @max_audit_log_age@.
51 The events being cleaned up by this process don't include job/container stderr logs (they're handled by the existing @delete job/container logs@ rake tasks)
52
53 h3. Additional consideration
54
55 Depending on the local installation's audit requirements, the cluster admins should plan for an external backup procedure before enabling this feature, as this information is not replicated anywhere else.