saving.adoc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. 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).
  5. You can configure the global setting for saving logs, or override it on a per-action basis;
  6. [source,yaml]
  7. .`config.yaml`
  8. ----
  9. saveLogs:
  10. resultsDirectory: /var/log/OliveTin/results/
  11. outputDirectory: /var/log/OliveTin/output/
  12. actions:
  13. # This will use the default `saveLogs` setting.
  14. - title: date
  15. shell: date
  16. # This will override the default `saveLogs` setting.
  17. - title: date2
  18. shell: date
  19. saveLogs:
  20. resultsDirectory: /logs/
  21. outputDirectory: /logs/
  22. ----
  23. From the above example, you can see there There are two types of logs - **results (.yaml)** and **output (.log)**
  24. 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.
  25. * **Results (.yaml)** - this captures almost everything that OliveTin knows about the action and looks like this.
  26. +
  27. [source,yaml]
  28. .Example results - date.1714333384.5e2dc9e5-b6b3-445b-bff9-c2082b0bbbb2.yaml
  29. ----
  30. datetimestarted: 2024-04-28T20:43:04.426754136+01:00
  31. datetimefinished: 2024-04-28T20:43:04.436596926+01:00
  32. stdout: |
  33. Sun 28 Apr 20:43:04 BST 2024
  34. stderr: ""
  35. timedout: false
  36. blocked: false
  37. exitcode: 0
  38. tags: []
  39. executionstarted: true
  40. executionfinished: true
  41. executiontrackingid: 5e2dc9e5-b6b3-445b-bff9-c2082b0bbbb2
  42. process:
  43. pid: 4168638
  44. actiontitle: date
  45. actionicon: '😀'
  46. actionid: d3cf6e25-8bab-432d-b4f9-e6f531b2b67b
  47. ----
  48. * **output (.log)** - this just captures the output - stdout, stderr from an execution,
  49. +
  50. [source]
  51. .Example output - date.1714333384.5e2dc9e5-b6b3-445b-bff9-c2082b0bbbb2.log
  52. ----
  53. Sun 28 Apr 20:43:04 BST 2024
  54. ----