Store Logs in object storeage instead of database #2278
Replies: 2 comments 3 replies
-
|
#3568 has been merged, it's possible now to use files to store the logs instead of the DB. |
Beta Was this translation helpful? Give feedback.
-
|
I want to implement this S3 log storage feature. BackgroundIn Woodpecker, agents send log chunks of around 1MB of data. Unfortunately, S3 doesn't support appending to an object. Implementation Options for the Interfacehttps://github.com/woodpecker-ci/woodpecker/blob/main/server/services/log/service.go#L5 The examples below are for a large log file (1GB) with 1000 append calls of 1MB each. S3 Pricing Reference (2025 US East):
1. Simple Approach (Single Object)LogAppend: Fetch the existing log file, add the new content, and push back to S3
LogFind: Fetch the entire file from S3 to memory, then unmarshal and return the parsed log
Note: This is extremely wasteful for LogAppend and can lead to OOM errors, but fast for LogFind 2. Chunked ApproachLogAppend: Every append creates a new object under a folder with the stepID (from
LogFind: Get the number of chunks in a step, then fetch them one by one and return the full log
Note: Woodpecker is read-intensive - after a step completes, it's mostly LogFind operations. Chunked approach has faster uploads but slower reads. 3. Optimized VariationsSimple approach optimization:
Chunked optimization (Database metadata): LogAppend:
LogFind:
Hybrid approach (Stream-to-disk): LogAppend:
LogFind:
Recommended Solution: Hybrid ApproachI think the best option is the hybrid approach, as it provides:
Would love to hear the maintainers thoughts on this approach. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
optional config (false by default) to store log streams in object storage
Bounty: 100$
Beta Was this translation helpful? Give feedback.
All reactions