Skip to content

Commit

Permalink
sysutils/fluent-bit: fix problems running the fluent-bit
Browse files Browse the repository at this point in the history
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] fluent/fluent-bit#3716
PR:	255593 [2]
  • Loading branch information
Palle Girgensohn authored and Palle Girgensohn committed Sep 2, 2021
1 parent 6161056 commit 2b5d514
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
1 change: 1 addition & 0 deletions sysutils/fluent-bit/Makefile
Expand Up @@ -3,6 +3,7 @@
PORTNAME= fluent-bit
DISTVERSIONPREFIX= v
DISTVERSION= 1.8.6
PORTREVISION= 1
CATEGORIES= sysutils

MAINTAINER= girgen@FreeBSD.org
Expand Down
20 changes: 17 additions & 3 deletions sysutils/fluent-bit/files/fluent-bit.in
Expand Up @@ -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

Expand All @@ -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"
20 changes: 20 additions & 0 deletions 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
11 changes: 11 additions & 0 deletions 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))

0 comments on commit 2b5d514

Please sign in to comment.