You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support compression for Actions logs to save storage space and
bandwidth. Inspired by
#24256 (comment)
The biggest challenge is that the compression format should support
[seekable](https://github.com/facebook/zstd/blob/dev/contrib/seekable_format/zstd_seekable_compression_format.md).
So when users are viewing a part of the log lines, Gitea doesn't need to
download the whole compressed file and decompress it.
That means gzip cannot help here. And I did research, there aren't too
many choices, like bgzip and xz, but I think zstd is the most popular
one. It has an implementation in Golang with
[zstd](https://github.com/klauspost/compress/tree/master/zstd) and
[zstd-seekable-format-go](https://github.com/SaveTheRbtz/zstd-seekable-format-go),
and what is better is that it has good compatibility: a seekable format
zstd file can be read by a regular zstd reader.
This PR introduces a new package `zstd` to combine and wrap the two
packages, to provide a unified and easy-to-use API.
And a new setting `LOG_COMPRESSION` is added to the config, although I
don't see any reason why not to use compression, I think's it's a good
idea to keep the default with `none` to be consistent with old versions.
`LOG_COMPRESSION` takes effect for only new log files, it adds `.zst` as
an extension to the file name, so Gitea can determine if it needs
decompression according to the file name when reading. Old files will
keep the format since it's not worth converting them, as they will be
cleared after #31735.
<img width="541" alt="image"
src="https://github.com/user-attachments/assets/e9598764-a4e0-4b68-8c2b-f769265183c9">
Copy file name to clipboardExpand all lines: custom/conf/app.example.ini
+6
Original file line number
Diff line number
Diff line change
@@ -2687,6 +2687,12 @@ LEVEL = Info
2687
2687
;DEFAULT_ACTIONS_URL = github
2688
2688
;; Logs retention time in days. Old logs will be deleted after this period.
2689
2689
;LOG_RETENTION_DAYS = 365
2690
+
;; Log compression type, `none` for no compression, `zstd` for zstd compression.
2691
+
;; Other compression types like `gzip` if NOT supported, since seekable stream is required for log view.
2692
+
;; It's always recommended to use compression when using local disk as log storage if CPU or memory is not a bottleneck.
2693
+
;; And for object storage services like S3, which is billed for requests, it would cause extra 2 times of get requests for each log view.
2694
+
;; But it will save storage space and network bandwidth, so it's still recommended to use compression.
2695
+
;LOG_COMPRESSION = none
2690
2696
;; Default artifact retention time in days. Artifacts could have their own retention periods by setting the `retention-days` option in `actions/upload-artifact` step.
2691
2697
;ARTIFACT_RETENTION_DAYS = 90
2692
2698
;; Timeout to stop the task which have running status, but haven't been updated for a long time
0 commit comments