Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

feat: Fluentbit investigation

Andras Bacsaie10b76a46b04
diff --git a/data/fluentd/Dockerfile-dev b/data/fluentd/Dockerfile-dev
new file mode 100644
index 0000000000..bb5524df9a
--- /dev/null
+++ b/data/fluentd/Dockerfile-dev
@@ -0,0 +1,6 @@
+FROM fluent/fluent-bit:1.9.0
+COPY fluentbit-dev.conf /tmp/fluentbit.conf
+ENTRYPOINT ["/fluent-bit/bin/fluent-bit", "-c", "/tmp/fluentbit.conf"]
+# USER root
+# RUN ["gem", "install", "fluent-plugin-mongo"]
+# USER fluent
\ No newline at end of file
diff --git a/data/fluentd/fluentbit-dev.conf b/data/fluentd/fluentbit-dev.conf
new file mode 100644
index 0000000000..8d06fd0af3
--- /dev/null
+++ b/data/fluentd/fluentbit-dev.conf
@@ -0,0 +1,24 @@
+[INPUT]
+ Name forward
+ Listen 0.0.0.0
+ Port 24224
+ Buffer_Chunk_Size 32KB
+ Buffer_Max_Size 64KB
+
+[OUTPUT]
+ Name influxdb
+ Match *
+ Host coolify-influxdb
+ Port 8086
+ Bucket containerlogs
+ Org organization
+ HTTP_Token supertoken
+ Sequence_Tag _seq
+ Tag_Keys container_name
+[OUTPUT]
+ Name http
+ Match *
+ Host host.docker.internal
+ Port 3000
+ URI /logs.json
+ Format json
\ No newline at end of file
diff --git a/data/fluentd/fluentd.conf b/data/fluentd/fluentd-dev.conf
similarity index 87%
rename from data/fluentd/fluentd.conf
rename to data/fluentd/fluentd-dev.conf
index 840c9cf028..9ae4a06c01 100644
--- a/data/fluentd/fluentd.conf
+++ b/data/fluentd/fluentd-dev.conf
@@ -6,7 +6,7 @@
<match **>
@type http
- endpoint http://172.17.0.1:3000/logs.json
+ endpoint http://host.docker.internal:3000/logs.json
<buffer>
flush_at_shutdown true
flush_mode immediate
diff --git a/docker-compose-dev.yaml b/docker-compose-dev.yaml
index 1958543271..6c89e87d58 100644
--- a/docker-compose-dev.yaml
+++ b/docker-compose-dev.yaml
@@ -11,7 +11,24 @@ services:
published: 6379
protocol: tcp
mode: host
-
+ # fluentbit:
+ # container_name: coolify-fluentbit
+ # build:
+ # context: ./data/fluentd
+ # dockerfile: Dockerfile-dev
+ # ports:
+ # - target: 24224
+ # published: 24224
+ # protocol: tcp
+ # mode: host
+ # - target: 24224
+ # published: 24224
+ # protocol: udp
+ # mode: host
+ # networks:
+ # - coolify-infra
+ # extra_hosts:
+ # - 'host.docker.internal:host-gateway'
networks:
coolify-infra:
attachable: true
diff --git a/src/routes/logs.json.ts b/src/routes/logs.json.ts
index 892fdce4e4..452d455e1f 100644
--- a/src/routes/logs.json.ts
+++ b/src/routes/logs.json.ts
@@ -1,8 +1,16 @@
import type { RequestHandler } from '@sveltejs/kit';
+import * as db from '$lib/database';
export const post: RequestHandler = async (event) => {
const data = await event.request.json();
- console.log(data);
+ for (const d of data) {
+ if (d.container_name) {
+ const { log, container_name: containerId, source } = d;
+ console.log(log);
+ // await db.prisma.applicationLogs.create({ data: { log, containerId: containerId.substr(1), source } });
+ }
+ }
+
return {
status: 200,
body: {}