package/fluent-bit: add new package
PATCH v2 1/1 package/fluent-bit: add new package
Fluent Bit is a super fast, lightweight, and highly scalable logging and metrics processor and forwarder.
--- package/Config.in | 1 + package/fluent-bit/Config.in | 13 +++++++ package/fluent-bit/S99fluent-bit | 55 ++++++++++++++++++++++++++++++ package/fluent-bit/fluent-bit.hash | 3 ++ package/fluent-bit/fluent-bit.mk | 43 +++++++++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 package/fluent-bit/Config.in create mode 100644 package/fluent-bit/S99fluent-bit create mode 100644 package/fluent-bit/fluent-bit.hash create mode 100644 package/fluent-bit/fluent-bit.mk
package/Config.in +1 -0
@@ -2610,6 +2610,7 @@ menu "System tools" source "package/efivar/Config.in" source "package/embiggen-disk/Config.in" source "package/emlog/Config.in" + source "package/fluent-bit/Config.in" source "package/ftop/Config.in" source "package/getent/Config.in" source "package/gkrellm/Config.in"
package/fluent-bit/Config.in new file +13 -0
@@ -0,0 +1,13 @@ +config BR2_PACKAGE_FLUENT_BIT + bool "fluent-bit" + depends on BR2_TOOLCHAIN_USES_GLIBC + depends on !BR2_STATIC_LIBS + select BR2_PACKAGE_OPENSSL + select BR2_PACKAGE_LIBYAML + help + Fast and Lightweight Logs and Metrics processor. + + https://github.com/fluent/fluent-bit + +comment "fluent-bit needs a glibc toolchain, dynamic library" + depends on !BR2_TOOLCHAIN_USES_GLIBC || BR2_STATIC_LIBS
package/fluent-bit/S99fluent-bit new file +55 -0
55 lines not on this page · raw message
package/fluent-bit/fluent-bit.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally computed +sha256 8ff5566389033669feabc9c69a5c6f417dad5c8b066454388e6a706507262acf fluent-bit-2.0.8.tar.gz +sha256 0d542e0c8804e39aa7f37eb00da5a762149dc682d7829451287e11b938e94594 LICENSE
package/fluent-bit/fluent-bit.mk new file +43 -0
43 lines not on this page · raw message
Signature · 6 lines
2.39.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Devoogdt <[email protected]> writes:
Fluent Bit is a super fast, lightweight, and highly scalable logging and metrics processor and forwarder.
Signed-off-by Thomas Devoogdt <[email protected]>
Now we just miss the change summary ;)
package/fluent-bit/S99fluent-bit line 6
Quoted 8 lines
+++ b/package/fluent-bit/S99fluent-bit
package/fluent-bit/S99fluent-bit new file +6
-0@@ -0,0 +1,55 @@ +#!/bin/sh +# +# Starts fluent-bit. +# +NAME=fluent-bit +DAEMON=/usr/bin/$NAME
check-package complains about this:
http://nightly.buildroot.org/#adding-packages-start-script
There are also some shellcheck warnings.
Quoted 14 lines
package/fluent-bit/S99fluent-bit new file +14
-0+PID_FILE="/var/run/$NAME.pid" +CONF_FILE="/etc/$NAME/$NAME.conf" + +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +start() { + printf "Starting fluent-bit: " + start-stop-daemon -S -q -b -m -p $PID_FILE --exec $DAEMON -- -c $CONF_FILE + [ $? = 0 ] && echo "OK" || echo "FAIL" +} + +stop() { + printf "Stopping fluent-bit: " + start-stop-daemon -K -q -p $PID_FILE
package/fluent-bit/S99fluent-bit line 30
Quoted 10 lines
package/fluent-bit/S99fluent-bit new file +10
-0+ # https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/yaml/configuration-file#config_section + # The default grace time is set to 5 seconds, so use 6 seconds to have some margin. + TIMEOUT=6 + PID=$(cat $PID_FILE 2>/dev/null) + while kill -0 $PID 2>/dev/null; do + [ $TIMEOUT -eq 0 ] && echo "FAIL" && return 1 + TIMEOUT=$((TIMEOUT - 1)) + sleep 1 + done + rm -f $PID_FILE
So the pidfile is not removed on timeouts. Is that on purpose?
Quoted 22 lines
package/fluent-bit/fluent-bit.mk new file +21
-0+++ b/package/fluent-bit/fluent-bit.mk@@ -0,0 +1,43 @@ +################################################################################ +# +# fluent-bit +# +################################################################################ + +FLUENT_BIT_VERSION = 2.0.8 +FLUENT_BIT_SITE = $(call github,fluent,fluent-bit,v$(FLUENT_BIT_VERSION)) +FLUENT_BIT_LICENSE = Apache-2.0 +FLUENT_BIT_LICENSE_FILES = LICENSE +FLUENT_BIT_DEPENDENCIES = host-bison host-flex libyaml libopenssl + +FLUENT_BIT_CONF_OPTS += \ + -DFLB_DEBUG=No \ + -DFLB_RELEASE=Yes \ + -DFLB_EXAMPLES=No \ + -DFLB_CHUNK_TRACE=No \ + -DFLB_BACKTRACE=No \ + -DFLB_LUAJIT=No +
package/fluent-bit/fluent-bit.mk line 30
Quoted 10 lines
package/fluent-bit/fluent-bit.mk new file +10
-0+# Undefining _FILE_OFFSET_BITS here because of a "bug" with glibc fts.h +# large file support. +# See https://bugzilla.redhat.com/show_bug.cgi?id=574992 for more information. +FLUENT_BIT_CONF_OPTS += \ + -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -U_FILE_OFFSET_BITS" \ + -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -U_FILE_OFFSET_BITS" + +# Move the config files from /usr/etc/ to /etc/. +FLUENT_BIT_CONF_OPTS += \ + -DCMAKE_INSTALL_SYSCONFDIR="/etc/"
Where do you see that it gets set to /usr/etc/? I just dropped this and ran the configure script and I ended up with the normal:
grep SYSCONFDIR build/fluent-bit-2.0.8/CMakeCache.txt CMAKE_INSTALL_SYSCONFDIR:PATH=etc
//ADVANCED property for variable: CMAKE_INSTALL_SYSCONFDIR CMAKE_INSTALL_SYSCONFDIR-ADVANCED:INTERNAL=1
And indeed, building it I don't see any references to /usr/etc:
strings build/fluent-bit-2.0.8/bin/fluent-bit | grep /etc /etc/machine-id/etc/ssl/certs/ca-bundle.crt/etc/ssl/certs//etc/hosts/etc/resolv.conf/etc/nsswitch.conf/etc/host.conf/etc/svc.conf
I do see that it gets confused and ends up installing the default config files in usr/etc/fluent-bit. I don't right away see why this is so, but indeed explicitly setting it to /etc fixes that. Notice that it does lead to an invalid service file:
https://github.com/fluent/fluent-bit/issues/6619
So maybe a better fix is to just move the files in a post-install hook?
package/fluent-bit/fluent-bit.mk line 41
Quoted 5 lines
package/fluent-bit/fluent-bit.mk new file +5
-0+define FLUENT_BIT_POST_INSTALL_TARGET_HOOK + cp -dpf $(@D)/lib/libminiz*.so* $(TARGET_DIR)/usr/lib/ +endef + +FLUENT_BIT_POST_INSTALL_TARGET_HOOKS += FLUENT_BIT_POST_INSTALL_TARGET_HOOK
Again, why not just build with -DBUILD_SHARED_LIBS=OFF?
I see that the package installs a shared library in a custom location:
target/usr/lib/fluent-bit/libfluent-bit.so
What is that used for / how does it find it? I see there is a FLB_SHARED_LIB option to disable it.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Op ma 23 jan. 2023 om 17:11 schreef Peter Korsgaard <[email protected]>:
Quoted 9 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
"Thomas" == Thomas Devoogdt <[email protected]> writes:
Fluent Bit is a super fast, lightweight, and highly scalable logging and metrics processor and forwarder.
Signed-off-by Thomas Devoogdt <[email protected]>Now we just miss the change summary ;)
Sorry about that. I'm not comfortable using git-mail. I at least won't be sad if buildroot goes to e.g. GitHub or GitLab.
But that is no excuse.
Quoted 11 lines
package/fluent-bit/S99fluent-bit line 6
Quoted 8 lines
+++ b/package/fluent-bit/S99fluent-bit
package/fluent-bit/S99fluent-bit new file +6
-0@@ -0,0 +1,55 @@ +#!/bin/sh +# +# Starts fluent-bit. +# +NAME=fluent-bit +DAEMON=/usr/bin/$NAMEcheck-package complains about this:
Quoted 3 lines
http://nightly.buildroot.org/#adding-packages-start-script
There are also some shellcheck warnings.
Will check.
Quoted 18 lines
Quoted 18 lines
package/fluent-bit/S99fluent-bit new file +18
-0+PID_FILE="/var/run/$NAME.pid" +CONF_FILE="/etc/$NAME/$NAME.conf" + +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +start() { + printf "Starting fluent-bit: " + start-stop-daemon -S -q -b -m -p $PID_FILE --exec $DAEMON -- -c $CONF_FILE + [ $? = 0 ] && echo "OK" || echo "FAIL" +} + +stop() { + printf "Stopping fluent-bit: " + start-stop-daemon -K -q -p $PID_FILE + # https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/yaml/configuration-file#config_section + # The default grace time is set to 5 seconds, so use 6 seconds to have some margin. + TIMEOUT=6 + PID=$(cat $PID_FILE 2>/dev/null)
Quoted 8 lines
package/fluent-bit/S99fluent-bit line 30
Quoted 6 lines
package/fluent-bit/S99fluent-bit new file +6
-0+ while kill -0 $PID 2>/dev/null; do + [ $TIMEOUT -eq 0 ] && echo "FAIL" && return 1 + TIMEOUT=$((TIMEOUT - 1)) + sleep 1 + done + rm -f $PID_FILESo the pidfile is not removed on timeouts. Is that on purpose?
No idea what is preferably, I see at least that it is also not removed in
https://nightly.buildroot.org/#adding-packages-start-script.
Quoted 53 lines
Quoted 22 lines
package/fluent-bit/fluent-bit.mk new file +21
-0+++ b/package/fluent-bit/fluent-bit.mk@@ -0,0 +1,43 @@ +################################################################################ +# +# fluent-bit +# +################################################################################ + +FLUENT_BIT_VERSION = 2.0.8 +FLUENT_BIT_SITE = $(call github,fluent,fluent-bit,v$(FLUENT_BIT_VERSION)) +FLUENT_BIT_LICENSE = Apache-2.0 +FLUENT_BIT_LICENSE_FILES = LICENSE +FLUENT_BIT_DEPENDENCIES = host-bison host-flex libyaml libopenssl + +FLUENT_BIT_CONF_OPTS += \ + -DFLB_DEBUG=No \ + -DFLB_RELEASE=Yes \ + -DFLB_EXAMPLES=No \ + -DFLB_CHUNK_TRACE=No \ + -DFLB_BACKTRACE=No \ + -DFLB_LUAJIT=No +package/fluent-bit/fluent-bit.mk line 30
Quoted 10 lines
package/fluent-bit/fluent-bit.mk new file +10
-0+# Undefining _FILE_OFFSET_BITS here because of a "bug" with glibc fts.h +# large file support. +# See https://bugzilla.redhat.com/show_bug.cgi?id=574992 for more information. +FLUENT_BIT_CONF_OPTS += \ + -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -U_FILE_OFFSET_BITS" \ + -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -U_FILE_OFFSET_BITS" + +# Move the config files from /usr/etc/ to /etc/. +FLUENT_BIT_CONF_OPTS += \ + -DCMAKE_INSTALL_SYSCONFDIR="/etc/"Where do you see that it gets set to
/usr/etc/? I just dropped this and ran the configure script and I ended up with the normal:grep SYSCONFDIR
build/fluent-bit-2.0.8/CMakeCache.txtCMAKE_INSTALL_SYSCONFDIR:PATH=etc
//ADVANCED property for variable:CMAKE_INSTALL_SYSCONFDIRCMAKE_INSTALL_SYSCONFDIR-ADVANCED:INTERNAL=1And indeed, building it I don't see any references to
/usr/etc:strings build/fluent-bit-2.0.8/bin/fluent-bit | grep /etc
/etc/machine-id/etc/ssl/certs/ca-bundle.crt/etc/ssl/certs//etc/hosts/etc/resolv.conf/etc/nsswitch.conf/etc/host.conf/etc/svc.conf
Quoted 8 lines
I do see that it gets confused and ends up installing the default config files in
usr/etc/fluent-bit. I don't right away see why this is so, but indeed explicitly setting it to /etc fixes that. Notice that it does lead to an invalid service file:https://github.com/fluent/fluent-bit/issues/6619
So maybe a better fix is to just move the files in a post-install hook?
I do prefer to get it done by setting CMAKE_INSTALL_SYSCONFDIR. But perhaps, we could wait the response on that thread?
Quoted 8 lines
package/fluent-bit/fluent-bit.mk line 41
Quoted 5 lines
package/fluent-bit/fluent-bit.mk new file +5
-0+define FLUENT_BIT_POST_INSTALL_TARGET_HOOK + cp -dpf $(@D)/lib/libminiz*.so* $(TARGET_DIR)/usr/lib/ +endef + +FLUENT_BIT_POST_INSTALL_TARGET_HOOKS += FLUENT_BIT_POST_INSTALL_TARGET_HOOKAgain, why not just build with -DBUILD_SHARED_LIBS=OFF?
Quoted 7 lines
I see that the package installs a shared library in a custom location:
target/usr/lib/fluent-bit/libfluent-bit.so
What is that used for / how does it find it? I see there is a
FLB_SHARED_LIBoption to disable it.
Already changed that in V3.
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
Quoted 3 lines
--
Bye, Peter Korsgaard
Kr,
Thomas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Devoogdt <[email protected]> writes:
Hello,
Quoted 5 lines
Quoted 1 line
Now we just miss the change summary ;)
Sorry about that. I'm not comfortable using git-mail. I at least won't be sad if buildroot goes to e.g. GitHub or GitLab.
But that is no excuse.
;)
We do have some documentation on
https://buildroot.org/downloads/manual/manual.html#submitting-patches,
but the summary is simply just to run git format-patch to generate the patch file, edit it to add the information about the change and then run git send-email on the patch file instead of directly running git send-email to generate patch + send it in one go.
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
package/fluent-bit/S99fluent-bit new file +13
-0+stop() { + printf "Stopping fluent-bit: " + start-stop-daemon -K -q -p $PID_FILE + # https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/yaml/configuration-file#config_section + # The default grace time is set to 5 seconds, so use 6 seconds to have some margin. + TIMEOUT=6 + PID=$(cat $PID_FILE 2>/dev/null) + while kill -0 $PID 2>/dev/null; do + [ $TIMEOUT -eq 0 ] && echo "FAIL" && return 1 + TIMEOUT=$((TIMEOUT - 1)) + sleep 1 + done + rm -f $PID_FILE
Quoted 4 lines
Quoted 1 line
So the pidfile is not removed on timeouts. Is that on purpose?
No idea what is preferably, I see at least that it is also not removed in
https://nightly.buildroot.org/#adding-packages-start-script.
My point was that you were explictly removing the pid file in the happy case (which is fine), but not in the unhappy one. Perhaps just move the rm line just above the while?
Quoted 11 lines
Quoted 8 lines
I do see that it gets confused and ends up installing the default config files in
usr/etc/fluent-bit. I don't right away see why this is so, but indeed explicitly setting it to /etc fixes that. Notice that it does lead to an invalid service file:https://github.com/fluent/fluent-bit/issues/6619
So maybe a better fix is to just move the files in a post-install hook?
I do prefer to get it done by setting
CMAKE_INSTALL_SYSCONFDIR. But perhaps, we could wait the response on that thread?
Ok. Perhaps add a reference to that bugreport in a comment?
Quoted 11 lines
Quoted 11 lines
package/fluent-bit/fluent-bit.mk line 41
Quoted 5 lines
package/fluent-bit/fluent-bit.mk new file +5
-0+define FLUENT_BIT_POST_INSTALL_TARGET_HOOK + cp -dpf $(@D)/lib/libminiz*.so* $(TARGET_DIR)/usr/lib/ +endef + +FLUENT_BIT_POST_INSTALL_TARGET_HOOKS += FLUENT_BIT_POST_INSTALL_TARGET_HOOKAgain, why not just build with -DBUILD_SHARED_LIBS=OFF?
I see that the package installs a shared library in a custom location:
Quoted 7 lines
Quoted 4 lines
target/usr/lib/fluent-bit/libfluent-bit.so
What is that used for / how does it find it? I see there is a
FLB_SHARED_LIBoption to disable it.Already changed that in V3.
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
I guess that is a reference to the miniz issue rather than the FLB_SHARED_LIB one? Why do you need to patch the sources for that instead of just passing -DBUILD_SHARED_LIBS=OFF in FLUENT_BIT_CONF_OPTS?
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot