Skip to content

Commit 5598323

Browse files
committed
feat: add production Kubernetes examples and fix GLIBC compatibility
- Build plugins inside manylinux_2_28 containers for portable binaries - Add production/ directory with init container examples that download plugins from GitHub Releases at pod startup - Auto-detect architecture (amd64/arm64) at runtime - Update README with GitHub Releases as primary download source - Document both init container and pre-built Docker image approaches The init container approach may still have GLIBC issues until the next release is built with the updated workflow.
1 parent e0efdea commit 5598323

File tree

8 files changed

+462
-141
lines changed

8 files changed

+462
-141
lines changed

.github/workflows/build.yaml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,35 @@ jobs:
1515
include:
1616
- arch: "amd64"
1717
runner: "ubuntu-24.04"
18+
manylinux: "quay.io/pypa/manylinux_2_28_x86_64"
1819
- arch: "arm64"
1920
runner: "ubuntu-24.04-arm"
21+
manylinux: "quay.io/pypa/manylinux_2_28_aarch64"
2022
steps:
2123
- uses: "actions/checkout@v4"
2224
with:
2325
submodules: "recursive"
2426

25-
- uses: "actions/setup-go@v5"
26-
with:
27-
go-version: "1.24"
27+
# Build inside manylinux container for glibc compatibility
28+
- name: "Build plugins"
29+
run: |
30+
docker run --rm -v "${{ github.workspace }}:/src" -w /src ${{ matrix.manylinux }} bash -c '
31+
set -e
2832
29-
- name: "Install task"
30-
run: "npm install -g @go-task/cli"
33+
# Install Go
34+
curl -fsSL "https://go.dev/dl/go1.24.3.linux-${{ matrix.arch }}.tar.gz" | tar -C /usr/local -xz
35+
export PATH="/usr/local/go/bin:$PATH"
3136
32-
- name: "Download clp-ffi-go libraries"
33-
run: "bash third-party/clp-ffi-go/scripts/download-libs.sh"
37+
# Install task
38+
curl -fsSL https://taskfile.dev/install.sh | sh -s -- -d -b /usr/local/bin
3439
35-
- name: "Build plugins"
36-
run: |
37-
task build:s3
38-
task build:s3v2
40+
# Download clp-ffi-go libraries
41+
bash third-party/clp-ffi-go/scripts/download-libs.sh
42+
43+
# Build plugins
44+
task build:s3
45+
task build:s3v2
46+
'
3947
4048
- name: "Upload artifacts"
4149
uses: "actions/upload-artifact@v4"
@@ -103,7 +111,7 @@ jobs:
103111
include:
104112
- plugin: "out_clp_s3"
105113
image: "fluent-bit-clp-s3"
106-
platforms: "linux/amd64"
114+
platforms: "linux/amd64,linux/arm64"
107115
- plugin: "out_clp_s3_v2"
108116
image: "fluent-bit-clp-s3-v2"
109117
platforms: "linux/amd64,linux/arm64"

README.md

Lines changed: 58 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
# Fluent Bit CLP Plugins
22

33
[Fluent Bit][fluent-bit] output plugins that compress logs using [CLP][clp-blog] for efficient
4-
storage and search on AWS S3.
5-
6-
## Table of Contents
7-
8-
- [Overview](#overview)
9-
- [Which Plugin Should I Use?](#which-plugin-should-i-use)
10-
- [Quick Start](#quick-start)
11-
- [Docker Images](#docker-images)
12-
- [Pre-built Binaries](#pre-built-binaries)
13-
- [Documentation](#documentation)
14-
- [Development](#development)
4+
storage and search on S3.
155

166
## Overview
177

@@ -23,126 +13,96 @@ flowchart LR
2313
D --> E[YScope Log Viewer]
2414
```
2515

26-
**[CLP][clp-blog]** (Compressed Log Processor) is a log compression tool that achieves 10-100x
27-
better compression than gzip while enabling fast search. These plugins compress logs into CLP's
28-
Intermediate Representation (IR) format with [Zstd][zstd] compression, then upload to S3.
16+
**[CLP][clp-blog]** (Compressed Log Processor) achieves 10-100x better compression than gzip while
17+
enabling fast search. These plugins compress logs into CLP's Intermediate Representation (IR)
18+
format with [Zstd][zstd] compression, then upload to S3.
2919

30-
Use [YScope Log Viewer][log-viewer] to view compressed logs directly in the browser, or ingest
31-
into CLP for search at scale.
20+
View compressed logs directly in the browser with [YScope Log Viewer][log-viewer], or ingest into
21+
CLP for search at scale.
3222

33-
## Which Plugin Should I Use?
23+
## Plugins
3424

35-
| Plugin | Upload Trigger | Best For |
36-
|--------|---------------|----------|
37-
| **[out_clp_s3_v2](plugins/out_clp_s3_v2/README.md)** | Time-based (per log level) | Kubernetes, latency-sensitive workloads |
38-
| **[out_clp_s3](plugins/out_clp_s3/README.md)** | Size-based (MB threshold) | Batch processing, size optimization |
25+
Two plugins with different log delivery strategies:
3926

40-
**Recommended: Start with `out_clp_s3_v2`** - it offers more control over upload latency and
41-
works well with Kubernetes deployments.
27+
| Plugin | Strategy | Description |
28+
|--------|----------|-------------|
29+
| **[out_clp_s3_v2](plugins/out_clp_s3_v2/README.md)** | Continuous sync | Compressed logs continuously synced to S3; sync frequency tunable to balance freshness vs cost |
30+
| **[out_clp_s3](plugins/out_clp_s3/README.md)** | Batch upload | Logs buffered locally until size threshold reached, then uploaded as batch |
4231

43-
### out_clp_s3_v2 (Recommended)
32+
### out_clp_s3_v2 — Continuous Sync
4433

45-
Time-based flushing with per-log-level control:
46-
- ERROR logs uploaded in seconds, DEBUG logs batched for minutes
47-
- Dual-timer strategy (hard + soft) prevents upload storms
34+
Log rotation is delegated to the log appender. The plugin continuously syncs compressed log files
35+
to S3.
36+
37+
- Higher severity logs (e.g., ERROR) trigger faster sync of the entire log file
38+
- Dual-timer strategy (hard + soft deadlines) prevents upload storms
4839
- Designed for Kubernetes (sidecar and DaemonSet patterns)
49-
- MinIO compatible for local development
5040

51-
### out_clp_s3
41+
### out_clp_s3 — Batch Upload
42+
43+
Logs are buffered locally and uploaded when a size threshold is reached.
5244

53-
Size-based uploads with crash recovery:
5445
- Upload when buffer reaches size threshold (default 16 MB)
5546
- Disk buffering with crash recovery
5647
- IAM role assumption for cross-account access
57-
- Single key extraction from log records
5848

5949
## Quick Start
6050

61-
### Docker Compose (Easiest)
62-
63-
The fastest way to try the plugins locally:
51+
The fastest way to try locally with Docker Compose:
6452

6553
```shell
66-
# out_clp_s3_v2 (recommended)
67-
cd plugins/out_clp_s3_v2/examples/docker-compose
68-
docker compose up
54+
git clone --recursive https://github.com/y-scope/fluent-bit-clp.git
55+
cd fluent-bit-clp
56+
57+
# Choose one:
58+
cd plugins/out_clp_s3_v2/examples/docker-compose # Continuous sync
59+
cd plugins/out_clp_s3/examples/docker-compose # Batch upload
6960

70-
# out_clp_s3
71-
cd plugins/out_clp_s3/examples/docker-compose
7261
docker compose up
7362
```
7463

75-
This starts MinIO, Fluent Bit with the plugin, and a log generator. View logs at
76-
http://localhost:9001 (minioadmin/minioadmin).
77-
78-
### Kubernetes (k3d)
64+
This starts MinIO (S3-compatible storage), Fluent Bit with the plugin, and a log generator.
65+
View logs at http://localhost:9001 (minioadmin/minioadmin).
7966

80-
```shell
81-
# Download plugins from GitHub Actions (see Pre-built Binaries section)
82-
# Extract to a local directory, e.g., ./plugins/
83-
84-
# Create k3d cluster with plugin mounted
85-
k3d cluster create yscope --servers 1 --agents 1 \
86-
-v $(pwd)/plugins:/fluent-bit/plugins \
87-
-p 9000:30000@agent:0 -p 9001:30001@agent:0
88-
89-
# Deploy MinIO and Fluent Bit
90-
cd plugins/out_clp_s3_v2/examples/kubernetes
91-
kubectl apply -f minio.yaml -f aws-credentials.yaml
92-
kubectl apply -f logs-bucket-creation.yaml
93-
kubectl apply -f sidecar/fluent-bit-sidecar.yaml -f sidecar/fluent-bit-sidecar-config.yaml
94-
```
67+
## Installation
9568

96-
See [Kubernetes Examples](plugins/out_clp_s3_v2/examples/kubernetes/README.md) for sidecar and
97-
DaemonSet deployment patterns.
69+
### Docker Images
9870

99-
### Docker (Build from Source)
71+
Pre-built Fluent Bit images with CLP plugins:
10072

10173
```shell
102-
# out_clp_s3_v2
103-
cd plugins/out_clp_s3_v2
104-
docker build -t fluent-bit-clp-v2 -f Dockerfile ../../
105-
docker run -v ~/.aws/credentials:/root/.aws/credentials fluent-bit-clp-v2
106-
107-
# out_clp_s3
108-
cd plugins/out_clp_s3
109-
docker build -t fluent-bit-clp -f Dockerfile ../../
110-
docker run -v ~/.aws/credentials:/root/.aws/credentials fluent-bit-clp
74+
docker pull ghcr.io/y-scope/fluent-bit-clp-s3-v2:latest # Continuous sync
75+
docker pull ghcr.io/y-scope/fluent-bit-clp-s3:latest # Batch upload
11176
```
11277

113-
## Docker Images
114-
115-
Pre-built Fluent Bit images with CLP plugins are published to GitHub Container Registry:
116-
117-
```shell
118-
# Time-based plugin (recommended)
119-
docker pull ghcr.io/y-scope/fluent-bit-clp-s3-v2:latest
78+
Images are tagged with `latest` (main branch), branch names, and commit SHAs.
12079

121-
# Size-based plugin
122-
docker pull ghcr.io/y-scope/fluent-bit-clp-s3:latest
123-
```
80+
### Pre-built Binaries
12481

125-
Images are tagged with `latest` (main branch), branch names, and commit SHAs.
82+
Standalone `.so` plugin files available from [GitHub Releases](../../releases):
12683

127-
## Pre-built Binaries
84+
| File | Architecture |
85+
|------|--------------|
86+
| `out_clp_s3_v2_linux_amd64.so` | x86_64 |
87+
| `out_clp_s3_v2_linux_arm64.so` | ARM64 |
88+
| `out_clp_s3_linux_amd64.so` | x86_64 |
89+
| `out_clp_s3_linux_arm64.so` | ARM64 |
12890

129-
Standalone plugin binaries (`.so` files) are also available as GitHub Actions artifacts.
91+
Also available as zip from [Actions → build](../../actions/workflows/build.yaml).
13092

131-
**Download:** Go to [Actions → build](../../actions/workflows/build.yaml), select a workflow run,
132-
and download the `fluent-bit-clp-plugins-linux-amd64` artifact.
93+
## Kubernetes
13394

134-
| File | Plugin |
135-
|------|--------|
136-
| `out_clp_s3_v2_linux_amd64.so` | Time-based plugin (recommended) |
137-
| `out_clp_s3_linux_amd64.so` | Size-based plugin |
95+
See [Kubernetes Examples](plugins/out_clp_s3_v2/examples/kubernetes/README.md) for:
96+
- Local development with k3d
97+
- Production deployment with init containers
98+
- Sidecar and DaemonSet patterns
13899

139100
## Documentation
140101

141102
| Document | Description |
142103
|----------|-------------|
143-
| [out_clp_s3_v2 README](plugins/out_clp_s3_v2/README.md) | Configuration, flush strategy, Kubernetes deployment |
144-
| [out_clp_s3 README](plugins/out_clp_s3/README.md) | Configuration, disk buffering, crash recovery |
145-
| [Kubernetes Examples](plugins/out_clp_s3_v2/examples/kubernetes/README.md) | Sidecar and DaemonSet deployments |
104+
| [out_clp_s3_v2 README](plugins/out_clp_s3_v2/README.md) | Configuration and flush strategy |
105+
| [out_clp_s3 README](plugins/out_clp_s3/README.md) | Configuration and disk buffering |
146106

147107
## Development
148108

@@ -151,22 +111,13 @@ and download the `fluent-bit-clp-plugins-linux-amd64` artifact.
151111
- Go 1.24+
152112
- [Task](https://taskfile.dev/installation/)
153113

154-
### Cloning
155-
156-
This project uses git submodules for the [clp-ffi-go](https://github.com/y-scope/clp-ffi-go)
157-
dependency:
114+
### Building
158115

159116
```shell
160-
# New clone (recommended)
117+
# Clone with submodules
161118
git clone --recursive https://github.com/y-scope/fluent-bit-clp.git
119+
cd fluent-bit-clp
162120

163-
# Existing clone
164-
git submodule update --init --recursive
165-
```
166-
167-
### Building
168-
169-
```shell
170121
# Download clp-ffi-go native libraries
171122
bash third-party/clp-ffi-go/scripts/download-libs.sh
172123

@@ -177,19 +128,11 @@ task build
177128
### Linting
178129

179130
```shell
180-
# Install prerequisites
181-
# - Task: https://taskfile.dev/installation/
182-
# - uv: https://docs.astral.sh/uv/getting-started/installation/
183-
184-
# Run checks
185-
task lint:check
186-
187-
# Auto-fix
188-
task lint:fix
131+
task lint:check # Run checks
132+
task lint:fix # Auto-fix
189133
```
190134

191-
> **Note:** Linting for the v1 plugin (`out_clp_s3`) is currently disabled and will be addressed in
192-
> a future update.
135+
> **Note:** Linting for `out_clp_s3` is temporarily disabled.
193136
194137
[clp-blog]: https://www.uber.com/blog/reducing-logging-cost-by-two-orders-of-magnitude-using-clp
195138
[fluent-bit]: https://fluentbit.io/

plugins/out_clp_s3/Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Build with manylinux for portable binaries compatible with Fluent Bit's runtime.
22
# manylinux_2_28 uses glibc 2.28, ensuring compatibility with most Linux distributions.
3-
#
4-
# Note: This plugin only supports amd64 architecture.
5-
FROM quay.io/pypa/manylinux_2_28_x86_64 AS builder
3+
FROM quay.io/pypa/manylinux_2_28_x86_64 AS builder-amd64
4+
FROM quay.io/pypa/manylinux_2_28_aarch64 AS builder-arm64
5+
6+
# Select the right base image based on target platform
7+
ARG TARGETARCH
8+
FROM builder-${TARGETARCH} AS builder
69

710
# Install Go
11+
ARG TARGETARCH
812
ARG GO_VERSION=1.24.3
9-
RUN curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /usr/local -xz
13+
RUN curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz" | tar -C /usr/local -xz
1014
ENV PATH="/usr/local/go/bin:${PATH}"
1115

1216
# Install task
@@ -27,7 +31,7 @@ RUN task build:s3
2731

2832
FROM fluent/fluent-bit:3.2.7
2933

30-
COPY --from=builder /src/pre-built/out_clp_s3_linux_amd64.so /fluent-bit/lib/out_clp_s3.so
34+
COPY --from=builder /src/pre-built/out_clp_s3_linux_*.so /fluent-bit/lib/out_clp_s3.so
3135
COPY --from=builder /src/plugins/out_clp_s3/*.conf /fluent-bit/etc/
3236

3337
EXPOSE 2020

0 commit comments

Comments
 (0)