From patchwork Thu Nov 9 16:39:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1862163 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SR73n6KGQz1yQK for ; Fri, 10 Nov 2023 03:40:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 2DC60416EA; Thu, 9 Nov 2023 16:40:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2DC60416EA X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vqVF2wgHNDiv; Thu, 9 Nov 2023 16:40:18 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id E5B7F41686; Thu, 9 Nov 2023 16:40:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E5B7F41686 X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id A0D311BF418 for ; Thu, 9 Nov 2023 16:40:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 86EEB40351 for ; Thu, 9 Nov 2023 16:40:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 86EEB40351 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XLMeowlZW-hm for ; Thu, 9 Nov 2023 16:40:02 +0000 (UTC) Received: from smtp-out.orange.com (smtp-out.orange.com [80.12.126.237]) by smtp4.osuosl.org (Postfix) with ESMTPS id 2506040321 for ; Thu, 9 Nov 2023 16:40:01 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2506040321 Received: from unknown (HELO opfedv3rlp0a.nor.fr.ftgroup) ([x.x.x.x]) by smtp-out.orange.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 17:39:59 +0100 Received: from unknown (HELO OPE16NORMBX305.corporate.adroot.infra.ftgroup) ([x.x.x.x]) by opfedv3rlp0a.nor.fr.ftgroup with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Nov 2023 17:39:59 +0100 Received: from tl-lnx-nyma7486-2 [x.x.x.x] by OPE16NORMBX305.corporate.adroot.infra.ftgroup [x.x.x.x] with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 9 Nov 2023 17:39:57 +0100 Received: by tl-lnx-nyma7486-2 (sSMTP sendmail emulation); Thu, 09 Nov 2023 17:39:57 +0100 X-IronPort-AV: E=Sophos;i="6.03,289,1694728800"; d="scan'208";a="64372297" From: To: Date: Thu, 9 Nov 2023 17:39:56 +0100 Message-ID: <876f3a7bb6a2375193fc8f06ab856d2449f83727.1699547993.git.yann.morin@orange.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.115.27.52] X-ClientProxiedBy: OPE16NORMBX502.corporate.adroot.infra.ftgroup (10.115.26.26) To OPE16NORMBX305.corporate.adroot.infra.ftgroup (10.115.27.10) X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.com; i=@orange.com; q=dns/txt; s=orange002; t=1699548002; x=1731084002; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ARxe5LIWvSNjoOb/k0BqWRhOdrdA8+G2m7Idp0ME3Ro=; b=I6fRu9PZMIe1vjXPVtdMQ2w6qSKzRkscm3VZXXk1Tphv/DdkBizWyjwq 2VNc0Z2pCjEraRL5/WykZy0s4vWM6Cc5c/9hNzJ8JnKkHsGZ+dDccHqJu yzpKd5GNr77yFHBBLjWJmc1EYFRmPKrz2ty4QTi0vw/qMk2ycQCTqecBH L86S91Ygz26SZCdwfyiUDzZdFDpJ01YO0ilXPYCfDGw5taaIkSsK6Rsoz A69S/w9hjcT1Xvp9tzU49VKIgPep+TWtHqn2tadT4NhiWQEeNxlZ50XR8 yaqWZJqkslTt+nEy0srM/rUDHINLSZtrUS9LMlJu72nREMC3xKvNkgLdr w==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=orange.com header.i=@orange.com header.a=rsa-sha256 header.s=orange002 header.b=I6fRu9PZ Subject: [Buildroot] [PATCH 1/2] package/pkg-golang: allow packages to provide extldflags X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yann.morin@orange.com, Nathaniel Roach Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" From: "Yann E. MORIN" For some packages, it may be necessary to pass extra extldflags. For example, some packages will need to be able to specify what ld to use, and so will need to pass -fuse-ld={bfd,gold} as extldflags. Introduce FOO_EXTLDFLAGS, that packages can set to pass such flags. Signed-off-by: Yann E. MORIN Tested-by: Nathaniel Roach --- docs/manual/adding-packages-golang.adoc | 6 ++++-- package/pkg-golang.mk | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/manual/adding-packages-golang.adoc b/docs/manual/adding-packages-golang.adoc index c952cde577..c238050096 100644 --- a/docs/manual/adding-packages-golang.adoc +++ b/docs/manual/adding-packages-golang.adoc @@ -84,8 +84,10 @@ therefore only use a few of them, or none. infrastructure will automatically generate a minimal +go.mod+ file in the package source tree if it doesn't exist. -* +FOO_LDFLAGS+ and +FOO_TAGS+ can be used to pass respectively the - +LDFLAGS+ or the +TAGS+ to the +go+ build command. +* +FOO_LDFLAGS+, +FOO_EXTLDFLAGS+, and +FOO_TAGS+ can be used to pass + respectively the go +LDFLAGS+ (via the `-ldflags` command line flag), + the external linker flags +EXTLDFLAGS+ (via the `-extldflags` + command line flag), or the +TAGS+ to the +go+ build command. * +FOO_BUILD_TARGETS+ can be used to pass the list of targets that should be built. If +FOO_BUILD_TARGETS+ is not specified, it diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk index 8e27602d41..206688fa7b 100644 --- a/package/pkg-golang.mk +++ b/package/pkg-golang.mk @@ -114,10 +114,14 @@ ifndef $(2)_BUILD_CMDS ifeq ($(4),target) ifeq ($(BR2_STATIC_LIBS),y) -$(2)_LDFLAGS += -extldflags '-static' +$(2)_EXTLDFLAGS += -static $(2)_TAGS += osusergo netgo endif +ifneq ($$($(2)_EXTLDFLAGS),) +$(2)_LDFLAGS += -extldflags '$$($(2)_EXTLDFLAGS)' +endif + # Build package for target define $(2)_BUILD_CMDS $$(foreach d,$$($(2)_BUILD_TARGETS),\ From patchwork Thu Nov 9 16:39:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1862164 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SR7443s8rz1yQK for ; Fri, 10 Nov 2023 03:40:36 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id BDDC741686; Thu, 9 Nov 2023 16:40:33 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org BDDC741686 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wLbZ0jfMVuy9; Thu, 9 Nov 2023 16:40:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 5A0F3416E6; Thu, 9 Nov 2023 16:40:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5A0F3416E6 X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 4148C1BF418 for ; Thu, 9 Nov 2023 16:40:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 19AD28135E for ; Thu, 9 Nov 2023 16:40:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 19AD28135E X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HL0L4njKlPWy for ; Thu, 9 Nov 2023 16:40:04 +0000 (UTC) Received: from smtp-out.orange.com (smtp-out.orange.com [80.12.126.239]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1FAF181352 for ; Thu, 9 Nov 2023 16:40:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1FAF181352 Received: from unknown (HELO opfedv3rlp0b.nor.fr.ftgroup) ([x.x.x.x]) by smtp-out.orange.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 17:40:00 +0100 Received: from unknown (HELO OPE16NORMBX305.corporate.adroot.infra.ftgroup) ([x.x.x.x]) by opfedv3rlp0b.nor.fr.ftgroup with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Nov 2023 17:40:01 +0100 Received: from tl-lnx-nyma7486-2 [x.x.x.x] by OPE16NORMBX305.corporate.adroot.infra.ftgroup [x.x.x.x] with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 9 Nov 2023 17:39:59 +0100 Received: by tl-lnx-nyma7486-2 (sSMTP sendmail emulation); Thu, 09 Nov 2023 17:39:59 +0100 X-IronPort-AV: E=Sophos;i="6.03,289,1694728800"; d="scan'208";a="64087871" From: To: Date: Thu, 9 Nov 2023 17:39:57 +0100 Message-ID: <46f20e86fa6c17ada33ede672ffe4229d8bf26a3.1699547993.git.yann.morin@orange.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.115.27.50] X-ClientProxiedBy: OPE16NORMBX501.corporate.adroot.infra.ftgroup (10.115.26.25) To OPE16NORMBX305.corporate.adroot.infra.ftgroup (10.115.27.10) X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.com; i=@orange.com; q=dns/txt; s=orange002; t=1699548004; x=1731084004; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9On/IRCRTTVJHOt+rPB/q8Ylst625haKAzvDaoz7xJM=; b=ec7mqaTmQkGBWlhwWhQr5+xoTjA688qGO8GKV6o1Q9KhxNViRN2wbvSW kFlY+QP1APGI705Ck8YVAgYnMwUXc4eT1OSkfznu1P1vIZIphmQ80sKkY oklC9EHJUQ24ahDY+PdO97m3xGMdYSx/0AvFAVtMJ4Y0soS7vvYRp7WRZ 2oNtNs17/lojzZamlktDgKxzlLCus8xdHAgmtwG624N/CnF2Q1AugJ2Er 9acMSpuDhZR0ubSPVBtWiZtrSOZUIpstS0wjZRsVI+jA4FvO9hFdNyXgr b2prFr56laFvgEPVp7S/+7tHkw6sQ9BVOdc0wlPWdnVEaLUyDWU4OM7Tx A==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=orange.com header.i=@orange.com header.a=rsa-sha256 header.s=orange002 header.b=ec7mqaTm Subject: [Buildroot] [PATCH 2/2] package/filebeat: new package X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yann.morin@orange.com, Nathaniel Roach , Vincent Fazio Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" From: "Yann E. MORIN" filebeat is one of the many Elastic 'beats' that can send data to a remote ElasticSearch (ES) engine or to a remote logstash. This is a go package, but the ES developers are using layers upon layers of abstractions to try and fail to provide an easier build mechanism. First, they use a convoluted set of Makefiles to wrap a lot of arcane commands. There is no obvious way to follow what's going on, especially as... ... second they use mage [0] as a first layer to abstract 'go build', but mage really does not play nicely in cross-compilation; it is a PITA to use, and it very easily gets confused. Building natively is also very fragile and heavily dependent on the user's environment (env, path, tools versions...), which makes it fails quite easily and spectacularly... But in the end, a simple "go build" works like a charm to build the beats' executable. This means we can just use Buildroot's golang-package infrastructure. Wee! On AArch64, the link may fail with errors like: [...] github.com/elastic/beats/v7/filebeat # github.com/elastic/beats/v7/filebeat [...]/output/per-package/filebeat/host/lib/go/pkg/tool/linux_amd64/link: running [...]/output/per-package/filebeat/host/bin/aarch64-linux-gcc failed: exit status 1 collect2: fatal error: cannot find ‘ld’ compilation terminated. The error happens because go, on AArch64, will forcibly want to use ld.gold, as a workaround for a alleged binutils breakage, as reported upstreams [1] [2] [3] [4]. This is supposedly fixed in binutils 2.36, but go still wants to use ld.gold. As not all toolchains have gold, force use of ld.bfd, which in practice has been shown to work correctly with recent-ish binutils versions: the link succeeds, and the program runs. This may still break on older toolchains, especially those with older binutils that did not have ld.gold (so they would not have ld.bfd either, just ld), but better have breakage on older toolchains, for which there's not much we can do, than on newer ones. (the same issue also occurred for ARM, but the ld.gold requirement was dropped in cd77738198ff, first included in go 1.21, which is now what we use in Buildroot) On riscv64, the build fails because of missing atomic ints: github.com/elastic/beats/v7/libbeat/statestore github.com/elastic/beats/v7/filebeat/inputsource/common/streaming # github.com/elastic/beats/v7/libbeat/statestore libbeat/statestore/store.go:28:18: undefined: atomic.Int libbeat/statestore/store.go:48:20: undefined: atomic.MakeInt github.com/elastic/beats/v7/libbeat/processors/ratelimit github.com/elastic/beats/v7/filebeat/input/kafka # github.com/elastic/beats/v7/filebeat/inputsource/common/streaming filebeat/inputsource/common/streaming/listener.go:48:25: undefined: atomic.Int # github.com/elastic/beats/v7/libbeat/processors/ratelimit libbeat/processors/ratelimit/token_bucket.go:53:20: undefined: atomic.Uint libbeat/processors/ratelimit/token_bucket.go:96:21: undefined: atomic.Uint libbeat/processors/ratelimit/token_bucket.go:193:34: undefined: atomic.MakeUint # github.com/elastic/beats/v7/filebeat/input/kafka filebeat/input/kafka/input.go:395:23: undefined: atomic.MakeInt That's because beats reimplement/wrap atomic ints, but the file implementing those is not whitelisted for riscv64 [1] (yes, 7.0 because this is what kafka's input module imports even in 8.8.2) and it has still not changed in 8.8.2 anyway [2] (thanks to Vincent Fazio for pointing those out). Running in an sysv-init environment is untested, and left as an exercise for interested parties. Finally, we only package version 8.8.2, because any later version can't be vendored [3]; it's been fixed [4] but is not part of any release yet. [0] https://magefile.org/ [1] https://github.com/golang/go/commit/3c8d6af8e02bbf230c2bef9f181d8ea393068299 [2] https://github.com/golang/go/issues/22040 [3] https://go-review.googlesource.com/c/go/+/22141 [4] https://sourceware.org/bugzilla/show_bug.cgi?id=19962 [5] https://github.com/elastic/beats/blame/7.0/libbeat/common/atomic/atomic64.go#L18 [6] https://github.com/elastic/beats/blame/v8.2.2/libbeat/common/atomic/atomic64.go#L18 [7] https://github.com/elastic/beats/issues/36949 [8] https://github.com/elastic/beats/pull/36953 Signed-off-by: Yann E. MORIN Cc: Vincent Fazio Tested-by: Nathaniel Roach --- Changes v1 -> v2: - fix Vincent's name, with my humble apologies - don't force ld.bfd for ARM (no longer needed) - don't install "data files" as they are useless (Nathaniel) - add entry to DEVELOPERS --- DEVELOPERS | 1 + package/Config.in | 1 + package/filebeat/Config.in | 14 +++++++++ package/filebeat/filebeat.default | 1 + package/filebeat/filebeat.hash | 5 +++ package/filebeat/filebeat.mk | 52 +++++++++++++++++++++++++++++++ package/filebeat/filebeat.service | 13 ++++++++ package/filebeat/filebeat.yml | 5 +++ 8 files changed, 92 insertions(+) create mode 100644 package/filebeat/Config.in create mode 100644 package/filebeat/filebeat.default create mode 100644 package/filebeat/filebeat.hash create mode 100644 package/filebeat/filebeat.mk create mode 100644 package/filebeat/filebeat.service create mode 100644 package/filebeat/filebeat.yml diff --git a/DEVELOPERS b/DEVELOPERS index 12257fae8c..94d0ef7cb5 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -3191,6 +3191,7 @@ F: support/download/ N: Yann E. MORIN F: .editorconfig +F: package/filebeat/ F: package/gpsd/ N: Yegor Yefremov diff --git a/package/Config.in b/package/Config.in index ce46d30fed..bdcc7e9d60 100644 --- a/package/Config.in +++ b/package/Config.in @@ -2356,6 +2356,7 @@ endif source "package/fail2ban/Config.in" source "package/fastd/Config.in" source "package/fcgiwrap/Config.in" + source "package/filebeat/Config.in" source "package/firewalld/Config.in" source "package/flannel/Config.in" source "package/fmc/Config.in" diff --git a/package/filebeat/Config.in b/package/filebeat/Config.in new file mode 100644 index 0000000000..78adae11cd --- /dev/null +++ b/package/filebeat/Config.in @@ -0,0 +1,14 @@ +config BR2_PACKAGE_FILEBEAT + bool "filebeat" + depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS + depends on !BR2_RISCV_64 + help + Lightweight data shippers + + Beats is a free and open platform for single-purpose data + shippers. They send data from hundreds or thousands of + machines and systems to Logstash or Elasticsearch. + + This package only installs filebeat. + + https://www.elastic.co/products/beats diff --git a/package/filebeat/filebeat.default b/package/filebeat/filebeat.default new file mode 100644 index 0000000000..ab51c81018 --- /dev/null +++ b/package/filebeat/filebeat.default @@ -0,0 +1 @@ +FILEBEAT_OPTS=-c /etc/filebeat/filebeat.yml diff --git a/package/filebeat/filebeat.hash b/package/filebeat/filebeat.hash new file mode 100644 index 0000000000..11a86f81f2 --- /dev/null +++ b/package/filebeat/filebeat.hash @@ -0,0 +1,5 @@ +# Locally computed +sha256 713d109760bbdfcdb30651861bd3899945114325ed65cb2bd744d7ff02c399a9 filebeat-8.8.2.tar.gz +sha256 23e50a1dead216922519026a878d3c75cc2860eb4ca6de186ac64100f85623f3 filebeat-8.8.2-linux-x86_64.tar.gz +sha256 7f0eb504dd0b8b090b52cff384296249be3168374f271b142ce03130c987c8e5 LICENSE.txt +sha256 928b3ded5ea8db33fadb8e5bea8bb10e1f79d2a904e9c97745f54b57e6a1588b NOTICE.txt diff --git a/package/filebeat/filebeat.mk b/package/filebeat/filebeat.mk new file mode 100644 index 0000000000..f9ae9ca630 --- /dev/null +++ b/package/filebeat/filebeat.mk @@ -0,0 +1,52 @@ +################################################################################ +# +# filebeat +# +################################################################################ + +# When updating, regenerate the list of licenses, below +FILEBEAT_VERSION = 8.8.2 +FILEBEAT_SITE = $(call github,elastic,beats,v$(FILEBEAT_VERSION)) +FILEBEAT_DL_SUBDIR = elastic-beats + +# License list obtained with: +# sed -r -e '/^Licence type.*: (.+)$/!d; s//\1/;' NOTICE.txt |sort -u +FILEBEAT_LICENSE = \ + Apache-2.0, \ + BSD, \ + BSD-2-Clause, \ + BSD-2-Clause-FreeBSD, \ + BSD-3-Clause, \ + Elastic, \ + ISC, \ + MIT, \ + MPL-2.0 + +FILEBEAT_LICENSE_FILES = LICENSE.txt NOTICE.txt + +FILEBEAT_GOMOD = github.com/elastic/beats/v7 +FILEBEAT_BUILD_TARGETS = filebeat + +ifeq ($(BR2_aarch64),y) +# On aarch64, go will forcibly use gold, on the assumption that ld.bfd is +# broken, but that is supposedly fixed on binutils master, and at least +# released in 2.36 onward. So, we force it back to use ld.bfd, as not all +# toolchains have ld.gold (for example, the Bootlin toolchians, built with +# Buildroot, do not). +FILEBEAT_EXTLDFLAGS += -fuse-ld=bfd +endif + +define FILEBEAT_INSTALL_CONFIG + $(INSTALL) -D -m 0644 $(FILEBEAT_PKGDIR)/filebeat.yml \ + $(TARGET_DIR)/etc/filebeat/filebeat.yml + $(INSTALL) -D -m 0644 $(FILEBEAT_PKGDIR)/filebeat.default \ + $(TARGET_DIR)/etc/default/filebeat +endef +FILEBEAT_POST_INSTALL_TARGET_HOOKS += FILEBEAT_INSTALL_CONFIG + +define FILEBEAT_INSTALL_INIT_SYSTEMD + $(INSTALL) -D -m 0644 $(FILEBEAT_PKGDIR)/filebeat.service \ + $(TARGET_DIR)/usr/lib/systemd/system/filebeat.service +endef + +$(eval $(golang-package)) diff --git a/package/filebeat/filebeat.service b/package/filebeat/filebeat.service new file mode 100644 index 0000000000..08234f50b6 --- /dev/null +++ b/package/filebeat/filebeat.service @@ -0,0 +1,13 @@ +[Unit] +Description=Filebeat +Wants=network-online.target +After=network-online.target + +[Service] +UMask=0027 +EnvironmentFile=/etc/default/filebeat +ExecStart=/usr/bin/filebeat --environment systemd $FILEBEAT_OPTS +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/package/filebeat/filebeat.yml b/package/filebeat/filebeat.yml new file mode 100644 index 0000000000..147c1d55dd --- /dev/null +++ b/package/filebeat/filebeat.yml @@ -0,0 +1,5 @@ +path: + home: /usr/share/filebeat + config: /etc/filebeat + data: /var/lib/filebeat + logs: /var/log/filebeat