Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Sep 2021 22:37:26 GMT
From:      Palle Girgensohn <girgen@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 2b5d5148c0f3 - main - sysutils/fluent-bit: fix problems running the fluent-bit
Message-ID:  <202109022237.182MbQua004574@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by girgen:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2b5d5148c0f32f81380555f1ade6269cd04ce716

commit 2b5d5148c0f32f81380555f1ade6269cd04ce716
Author:     Palle Girgensohn <girgen@FreeBSD.org>
AuthorDate: 2021-09-02 22:27:32 +0000
Commit:     Palle Girgensohn <girgen@FreeBSD.org>
CommitDate: 2021-09-02 22:37:18 +0000

    sysutils/fluent-bit: fix problems running the fluent-bit
    
    There is a known problem with the default coro_stack_size being too
    small. Double it to avoid failing to start. [1]
    
    Since the daemon option seems to be somewhat funky [2], use daemon to
    wrap the fluent-bit binary when running from the rc.d script.
    
    [1] https://github.com/fluent/fluent-bit/issues/3716
    PR:     255593 [2]
---
 sysutils/fluent-bit/Makefile                         |  1 +
 sysutils/fluent-bit/files/fluent-bit.in              | 20 +++++++++++++++++---
 .../fluent-bit/files/patch-conf__fluent-bit.conf     | 20 ++++++++++++++++++++
 .../files/patch-include__fluent-bit__flb_coro.h      | 11 +++++++++++
 4 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/sysutils/fluent-bit/Makefile b/sysutils/fluent-bit/Makefile
index 28943856fbfc..fa6846741898 100644
--- a/sysutils/fluent-bit/Makefile
+++ b/sysutils/fluent-bit/Makefile
@@ -3,6 +3,7 @@
 PORTNAME=	fluent-bit
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.8.6
+PORTREVISION=	1
 CATEGORIES=	sysutils
 
 MAINTAINER=	girgen@FreeBSD.org
diff --git a/sysutils/fluent-bit/files/fluent-bit.in b/sysutils/fluent-bit/files/fluent-bit.in
index 85ae67e7aee6..10ecfef930cb 100644
--- a/sysutils/fluent-bit/files/fluent-bit.in
+++ b/sysutils/fluent-bit/files/fluent-bit.in
@@ -12,7 +12,7 @@
 # fluent_bit_config (str):	config files to use
 #				Default: %%ETCDIR%%/fluent-bit.conf
 # fluent_bit_flags (str):	Extra flags passed to fluent-bit
-# fluent_bit_user (str):        Default run as user nobody
+# fluent_bit_user (str):	Default run as user nobody
 
 . /etc/rc.subr
 
@@ -22,8 +22,22 @@ load_rc_config $name
 
 : ${fluent_bit_enable:="NO"}
 : ${fluent_bit_user:="nobody"}
+: ${fluent_bit_group:="nogroup"}
+: ${fluent_bit_config:="%%ETCDIR%%/fluent-bit.conf"}
 
-command=%%PREFIX%%/bin/fluent-bit
-command_args="--quiet --daemon --config %%ETCDIR%%/fluent-bit.conf"
+pidfile=/var/run/${name}.pid
+procname="%%PREFIX%%/bin/fluent-bit"
+command="/usr/sbin/daemon"
+command_args="-H -p ${pidfile} -o /var/log/${name}/${name}.log ${procname} --quiet --config ${fluent_bit_config} ${fluent_bit_flags} --daemon"
+
+start_precmd=fluent_bit_startprecmd
+
+fluent_bit_startprecmd()
+{
+	install -o ${fluent_bit_user} -g ${fluent_bit_group} -d /var/log/${name}
+	if [ ! -e ${pidfile} ]; then
+		install -o ${fluent_bit_user} -g ${fluent_bit_group} /dev/null ${pidfile};
+	fi
+}
 
 run_rc_command "$1"
diff --git a/sysutils/fluent-bit/files/patch-conf__fluent-bit.conf b/sysutils/fluent-bit/files/patch-conf__fluent-bit.conf
new file mode 100644
index 000000000000..a373dcab8cc6
--- /dev/null
+++ b/sysutils/fluent-bit/files/patch-conf__fluent-bit.conf
@@ -0,0 +1,20 @@
+--- conf/fluent-bit.conf.orig	2021-09-02 23:28:51.035454000 +0200
++++ conf/fluent-bit.conf	2021-09-02 23:38:09.521171000 +0200
+@@ -81,12 +81,13 @@
+     #
+     # storage.backlog.mem_limit 5M
+ 
+-[INPUT]
+-    name cpu
+-    tag  cpu.local
++#[INPUT]
++    # fails on FreeBSD for some reason, propably not supported
++    # name cpu
++    # tag  cpu.local
+ 
+     # Read interval (sec) Default: 1
+-    interval_sec 1
++    # interval_sec 1
+ 
+ [OUTPUT]
+     name  stdout
diff --git a/sysutils/fluent-bit/files/patch-include__fluent-bit__flb_coro.h b/sysutils/fluent-bit/files/patch-include__fluent-bit__flb_coro.h
new file mode 100644
index 000000000000..7d0b2f0548fc
--- /dev/null
+++ b/sysutils/fluent-bit/files/patch-include__fluent-bit__flb_coro.h
@@ -0,0 +1,11 @@
+--- include/fluent-bit/flb_coro.h.orig	2021-09-02 23:11:40.144014000 +0200
++++ include/fluent-bit/flb_coro.h	2021-09-02 23:12:34.983243000 +0200
+@@ -65,7 +65,7 @@
+ #ifdef FLB_CORO_STACK_SIZE
+ #define FLB_CORO_STACK_SIZE      FLB_CORO_STACK_SIZE
+ #else
+-#define FLB_CORO_STACK_SIZE      ((3 * PTHREAD_STACK_MIN) / 2)
++#define FLB_CORO_STACK_SIZE      ((6 * PTHREAD_STACK_MIN) / 2)
+ #endif
+ 
+ #define FLB_CORO_DATA(coro)      (((char *) coro) + sizeof(struct flb_coro))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109022237.182MbQua004574>