saving.adoc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. [#save-logs]
  2. = Saving logs
  3. By default, OliveTin only keeps logs in memory, meaning that if you restart OliveTin your logs will be lost. For some use cases this is acceptable, but you can configure OliveTin to save logs for you.
  4. [#log-history-limit]
  5. == How many logs are kept in memory
  6. OliveTin keeps up to 2000 execution logs in memory, which is what the Logs pages show. When there are more, the oldest finished logs are removed. Logs for executions that are still running or queued are never removed, and neither are logs that still count towards an action's xref:action_customization/ratelimiting.adoc[rate limit].
  7. You can change the limit with `logHistoryLimit` (minimum `100`):
  8. [source,yaml]
  9. .`config.yaml`
  10. ----
  11. logHistoryLimit: 5000
  12. ----
  13. Logs saved to disk with `saveLogs` are not removed. When OliveTin starts, it loads the newest saved logs up to the limit.
  14. When `saveLogs` is enabled, OliveTin writes a file for each configured directory when an execution finishes — a results YAML when `resultsDirectory` is set, and an output log when `outputDirectory` is set. If only one directory is configured, only that file type is written. This includes blocked runs (for example when concurrency or rate limits prevent the action from starting).
  15. You can configure the global setting for saving logs, or override it on a per-action basis;
  16. [source,yaml]
  17. .`config.yaml`
  18. ----
  19. saveLogs:
  20. resultsDirectory: /var/log/OliveTin/results/
  21. outputDirectory: /var/log/OliveTin/output/
  22. actions:
  23. # This will use the default `saveLogs` setting.
  24. - title: date
  25. shell: date
  26. # This will override the default `saveLogs` setting.
  27. - title: date2
  28. shell: date
  29. saveLogs:
  30. resultsDirectory: /logs/
  31. outputDirectory: /logs/
  32. ----
  33. From the above example, you can see there There are two types of logs - **results (.yaml)** and **output (.log)**
  34. Filenames are built from the action title, a unix timestamp, and the execution tracking ID. Characters that are unsafe in filenames (for example `/` and `\`) are replaced with `_` so titles like `Create/update Monthly Report` still write a single file. The original title is unchanged inside the results YAML.
  35. * **Results (.yaml)** - this captures almost everything that OliveTin knows about the action and looks like this.
  36. +
  37. [source,yaml]
  38. .Example results - date.1714333384.5e2dc9e5-b6b3-445b-bff9-c2082b0bbbb2.yaml
  39. ----
  40. datetimestarted: 2024-04-28T20:43:04.426754136+01:00
  41. datetimefinished: 2024-04-28T20:43:04.436596926+01:00
  42. stdout: |
  43. Sun 28 Apr 20:43:04 BST 2024
  44. stderr: ""
  45. timedout: false
  46. blocked: false
  47. exitcode: 0
  48. tags: []
  49. executionstarted: true
  50. executionfinished: true
  51. executiontrackingid: 5e2dc9e5-b6b3-445b-bff9-c2082b0bbbb2
  52. process:
  53. pid: 4168638
  54. actiontitle: date
  55. actionicon: '😀'
  56. actionid: d3cf6e25-8bab-432d-b4f9-e6f531b2b67b
  57. ----
  58. * **output (.log)** - this just captures the output - stdout, stderr from an execution,
  59. +
  60. [source]
  61. .Example output - date.1714333384.5e2dc9e5-b6b3-445b-bff9-c2082b0bbbb2.log
  62. ----
  63. Sun 28 Apr 20:43:04 BST 2024
  64. ----