Skip to content

Commit 723f535

Browse files
Nr 91173 fluent bit 3 windows (#1909)
* NR-91173 feat: fluent bit 3.x under FF * NR-91173 feat: fluent-bit 3.x on Windows * eat: Upgrade to FB on windows 3.0.6 * feat: fluent_bit19 remove fflag check on linux and add new fflag for windows --------- Co-authored-by: Ruben Ruiz de Gauna <[email protected]>
1 parent 681300c commit 723f535

File tree

19 files changed

+247
-24
lines changed

19 files changed

+247
-24
lines changed

build/embed/fluent-bit.version

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
# OS, newrelic_plugin_version, fluent-bit
77

88
linux,1.19.1
9-
windows,1.19.1,1.9.3
9+
windows,1.19.1,3.0.6
10+
#To be removed on removal of the ff fluent_bit_19
11+
windows-legacy,1.19.1,1.9.3

build/package/windows/newrelic-infra-386-installer/newrelic-infra/Product.wxs

+36-1
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@
3737
<ComponentRef Id="CMP_V1_CUSTOM_PLUGINS" />
3838
<ComponentRef Id="CMP_V1_NR_PLUGINS" />
3939
<ComponentRef Id="CMP_LOGGING_TOOL" />
40+
<ComponentRef Id="CMP_LOGGING_TOOL_FB2" />
4041
<ComponentRef Id="CMP_LOGGING_TOOL_CFG" />
4142
<ComponentRef Id="NewRelicInfraDataComponent" />
4243
<ComponentGroupRef Id="ProductComponents" />
4344
<ComponentGroupRef Id="BundledPluginDefinitionComponents" />
4445
<ComponentGroupRef Id="BundledPluginConfigComponents" />
4546
<ComponentGroupRef Id="BundledPluginComponents" />
4647
<ComponentGroupRef Id="LoggingToolComponents" />
48+
<ComponentGroupRef Id="LoggingToolFB2Components" />
4749
<ComponentGroupRef Id="LoggingToolCfgComponents" />
4850
</Feature>
4951
</Product>
@@ -70,7 +72,8 @@
7072
<Directory Id="LoggingToolCfg" Name="logging.d" />
7173
<Directory Id="V1CustomPluginsFolder" Name="custom-integrations" />
7274
<Directory Id="V1NRPluginsFolder" Name="newrelic-integrations">
73-
<Directory Id="LoggingTool" Name="logging" />
75+
<Directory Id="LoggingTool" Name="logging-legacy" />
76+
<Directory Id="LoggingToolFB2" Name="logging" />
7477
</Directory>
7578
</Directory>
7679
</Directory>
@@ -99,6 +102,11 @@
99102
<CreateFolder />
100103
</Component>
101104
</DirectoryRef>
105+
<DirectoryRef Id="LoggingToolFB2">
106+
<Component Id="CMP_LOGGING_TOOL_FB2" Guid="D66DA13A-2F34-409B-9FF2-4CA00B0BB8B7" KeyPath="yes">
107+
<CreateFolder />
108+
</Component>
109+
</DirectoryRef>
102110
<DirectoryRef Id="V1NRPluginsFolder">
103111
<Component Id="CMP_V1_NR_PLUGINS" Guid="070708D0-87B5-4543-83C3-5A037A15BD5B" KeyPath="yes">
104112
<CreateFolder />
@@ -243,6 +251,7 @@
243251
</ComponentGroup>
244252
</Fragment>
245253

254+
<!-- <To be removed on removal of the ff fluent_bit_19> -->
246255
<Fragment>
247256
<ComponentGroup Id="LoggingToolComponents" Directory="LoggingTool">
248257
<Component Id="CMP_LOGGING_TOOL_BIN" Guid="015B10A1-7843-4961-B221-CBB449A6646C" Win64="no">
@@ -267,6 +276,32 @@
267276
</Component>
268277
</ComponentGroup>
269278
</Fragment>
279+
<!-- </To be removed on removal of the ff fluent_bit_19> -->
280+
281+
<Fragment>
282+
<ComponentGroup Id="LoggingToolFB2Components" Directory="LoggingToolFB2">
283+
<Component Id="CMP_LOGGING_FB2_TOOL_BIN" Guid="A6D1104A-F822-4D5C-AD0E-7B90B4CADA81" Win64="no">
284+
<File Id="FILE_LOGGING_FB2_TOOL_BIN"
285+
Source="$(var.EmbedBinariesPath)logging\nrfb2\fluent-bit.exe"
286+
KeyPath="yes" />
287+
</Component>
288+
<Component Id="CMP_LOGGING_FB2_TOOL_DLL" Guid="7F9069E1-BBFB-4A3F-966E-8E3C092E23C6" Win64="no">
289+
<File Id="FILE_LOGGING_FB2_TOOL_DLL"
290+
Source="$(var.EmbedBinariesPath)logging\nrfb2\fluent-bit.dll"
291+
KeyPath="yes" />
292+
</Component>
293+
<Component Id="CMP_NR_LOGGING_FB2_TOOL_DLL" Guid="FA321297-4693-4402-BE78-105B0234C75A" Win64="no">
294+
<File Id="FILE_NR_LOGGING_FB2_TOOL_DLL"
295+
Source="$(var.EmbedBinariesPath)logging\nrfb2\out_newrelic.dll"
296+
KeyPath="yes" />
297+
</Component>
298+
<Component Id="CMP_NR_LOGGING_FB2_TOOL_PARSERS" Guid="C99EA5B8-447F-4653-821B-BF30F994F4CE" Win64="no">
299+
<File Id="FILE_NR_LOGGING_FB2_TOOL_PARSERS"
300+
Source="$(var.ExternalFilesPath)examples\logging\parsers.conf"
301+
KeyPath="yes" />
302+
</Component>
303+
</ComponentGroup>
304+
</Fragment>
270305

271306
<Fragment>
272307
<ComponentGroup Id="LoggingToolCfgComponents" Directory="LoggingToolCfg">

build/package/windows/newrelic-infra-amd64-installer/newrelic-infra/Product.wxs

+36-1
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
<ComponentRef Id="CMP_V1_CUSTOM_PLUGINS" />
3838
<ComponentRef Id="CMP_V1_NR_PLUGINS" />
3939
<ComponentRef Id="CMP_LOGGING_TOOL" />
40+
<ComponentRef Id="CMP_LOGGING_TOOL_FB2" />
4041
<ComponentRef Id="CMP_LOGGING_TOOL_CFG" />
4142
<ComponentRef Id="NewRelicInfraDataComponent" />
4243
<ComponentGroupRef Id="ProductComponents" />
4344
<ComponentGroupRef Id="BundledPluginConfigComponents" />
4445
<ComponentGroupRef Id="BundledPluginComponents" />
4546
<ComponentGroupRef Id="LoggingToolComponents" />
47+
<ComponentGroupRef Id="LoggingToolFB2Components" />
4648
<ComponentGroupRef Id="LoggingToolCfgComponents" />
4749
</Feature>
4850
</Product>
@@ -71,7 +73,8 @@
7173
<Directory Id="LoggingToolCfg" Name="logging.d" />
7274
<Directory Id="V1CustomPluginsFolder" Name="custom-integrations" />
7375
<Directory Id="V1NRPluginsFolder" Name="newrelic-integrations">
74-
<Directory Id="LoggingTool" Name="logging" />
76+
<Directory Id="LoggingTool" Name="logging-legacy" />
77+
<Directory Id="LoggingToolFB2" Name="logging" />
7578
</Directory>
7679
</Directory>
7780
</Directory>
@@ -99,6 +102,11 @@
99102
<Component Id="CMP_LOGGING_TOOL" Guid="97CBE086-FE32-44FE-B035-9B7D66A422AD" KeyPath="yes">
100103
<CreateFolder />
101104
</Component>
105+
</DirectoryRef>
106+
<DirectoryRef Id="LoggingToolFB2">
107+
<Component Id="CMP_LOGGING_TOOL_FB2" Guid="AA775C42-74B2-4260-A477-3CC57B5D5842" KeyPath="yes">
108+
<CreateFolder />
109+
</Component>
102110
</DirectoryRef>
103111
<DirectoryRef Id="V1NRPluginsFolder">
104112
<Component Id="CMP_V1_NR_PLUGINS" Guid="48198DB9-B622-49E6-B7B4-AEED7B7378DB" KeyPath="yes">
@@ -226,6 +234,7 @@
226234
</InstallExecuteSequence>
227235
</Fragment>
228236

237+
<!-- <To be removed on removal of the ff fluent_bit_19> -->
229238
<Fragment>
230239
<ComponentGroup Id="LoggingToolComponents" Directory="LoggingTool">
231240
<Component Id="CMP_LOGGING_TOOL_BIN" Guid="015B10A1-7843-4961-B221-CBB449A6646C" Win64="yes">
@@ -250,6 +259,32 @@
250259
</Component>
251260
</ComponentGroup>
252261
</Fragment>
262+
<!-- </To be removed on removal of the ff fluent_bit_19> -->
263+
264+
<Fragment>
265+
<ComponentGroup Id="LoggingToolFB2Components" Directory="LoggingToolFB2">
266+
<Component Id="CMP_LOGGING_FB2_TOOL_BIN" Guid="297401DE-6C77-4523-AE2D-E2B4982A34E2" Win64="yes">
267+
<File Id="FILE_LOGGING_FB2_TOOL_BIN"
268+
Source="$(var.EmbedBinariesPath)logging\nrfb2\fluent-bit.exe"
269+
KeyPath="yes" />
270+
</Component>
271+
<Component Id="CMP_LOGGING_FB2_TOOL_DLL" Guid="B0652EBD-1F42-46CA-B1F6-2BAB76117A04" Win64="yes">
272+
<File Id="FILE_LOGGING_FB2_TOOL_DLL"
273+
Source="$(var.EmbedBinariesPath)logging\nrfb2\fluent-bit.dll"
274+
KeyPath="yes" />
275+
</Component>
276+
<Component Id="CMP_NR_LOGGING_FB2_TOOL_DLL" Guid="76F95029-80F0-4CB2-96B2-D414608E92F7" Win64="yes">
277+
<File Id="FILE_NR_LOGGING_FB2_TOOL_DLL"
278+
Source="$(var.EmbedBinariesPath)logging\nrfb2\out_newrelic.dll"
279+
KeyPath="yes" />
280+
</Component>
281+
<Component Id="CMP_NR_LOGGING_FB2_TOOL_PARSERS" Guid="52DC6B7E-EF16-4A49-8A2D-F963030B0916" Win64="yes">
282+
<File Id="FILE_NR_LOGGING_FB2_TOOL_PARSERS"
283+
Source="$(var.ExternalFilesPath)examples\logging\parsers.conf"
284+
KeyPath="yes" />
285+
</Component>
286+
</ComponentGroup>
287+
</Fragment>
253288

254289
<Fragment>
255290
<ComponentGroup Id="LoggingToolCfgComponents" Directory="LoggingToolCfg">

build/windows/scripts/embed_ohis.ps1

+19-3
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,33 @@ Function EmbedPrometheus {
7373
Function EmbedFluentBit {
7474
Write-Output "--- Embedding fluent-bit"
7575

76+
# <To be removed on removal of the ff fluent_bit_19>
77+
# td-agent-bit (1.9)
78+
$pluginLegacyVersion = GetFluentBitLegacyPluginVersion
79+
$nrfbLegacyVersion = GetFluentBitLegacyVersion
80+
81+
[string]$pluginLegacyUrl = "https://github.com/newrelic/newrelic-fluent-bit-output/releases/download/v$pluginLegacyVersion/out_newrelic-windows-$arch-$pluginLegacyVersion.dll"
82+
DownloadFile -dest:"$downloadPath\logging\nrfb" -outFile:"out_newrelic.dll" -url:"$pluginLegacyUrl"
83+
84+
[string]$nrfbUrl = "https://github.com/newrelic-experimental/fluent-bit-package/releases/download/$nrfbLegacyVersion/fb-windows-$arch.zip"
85+
DownloadAndExtractZip -dest:"$downloadPath\logging\nrfb" -url:"$nrfbUrl"
86+
# </To be removed on removal of the ff fluent_bit_19>
87+
88+
## fluent-bit (3.x)
7689
$pluginVersion = GetFluentBitPluginVersion
7790
$nrfbVersion = GetFluentBitVersion
7891

7992
[string]$pluginUrl = "https://github.com/newrelic/newrelic-fluent-bit-output/releases/download/v$pluginVersion/out_newrelic-windows-$arch-$pluginVersion.dll"
80-
DownloadFile -dest:"$downloadPath\logging\nrfb" -outFile:"out_newrelic.dll" -url:"$pluginUrl"
93+
DownloadFile -dest:"$downloadPath\logging\nrfb2" -outFile:"out_newrelic.dll" -url:"$pluginUrl"
8194

82-
[string]$nrfbUrl = "https://github.com/newrelic-experimental/fluent-bit-package/releases/download/$nrfbVersion/fb-windows-$arch.zip"
83-
DownloadAndExtractZip -dest:"$downloadPath\logging\nrfb" -url:"$nrfbUrl"
95+
[string]$nrfbUrl = "https://logging-fb-windows-packages.s3.us-east-2.amazonaws.com/fb-windows-$nrfbVersion-$arch.zip"
96+
DownloadAndExtractZip -dest:"$downloadPath\logging\nrfb2" -url:"$nrfbUrl"
8497

8598
if (-Not $skipSigning) {
99+
# <To be removed on removal of the ff fluent_bit_19>
86100
SignExecutable -executable "$downloadPath\logging\nrfb\fluent-bit.exe"
101+
# </To be removed on removal of the ff fluent_bit_19>
102+
SignExecutable -executable "$downloadPath\logging\nrfb2\fluent-bit.exe"
87103
}
88104
}
89105

build/windows/scripts/functions.ps1

+26-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,33 @@ Function GetIntegrationVersion {
3030
return $version
3131
}
3232

33+
# <To be removed on removal of the ff fluent_bit_19>
34+
Function GetFluentBitLegacyPluginVersion {
35+
$dir = "$scriptPath\..\..\embed"
36+
37+
$pluginVersion = $(Get-Content "$dir/fluent-bit.version" | %{if($_ -match "^windows-legacy,") { $_.Split(',')[1]; }})
38+
if ([string]::IsNullOrWhitespace($pluginVersion)) {
39+
throw "failed to read nr fluent-bit plugin version"
40+
}
41+
42+
return $pluginVersion
43+
}
44+
45+
Function GetFluentBitLegacyVersion {
46+
$dir = "$scriptPath\..\..\embed"
47+
$fbVersion = $(Get-Content "$dir/fluent-bit.version" | %{if($_ -match "^windows-legacy,") { $_.Split(',')[2]; }})
48+
if ([string]::IsNullOrWhitespace($fbVersion)) {
49+
throw "failed to read nr fluent-bit 1.x version"
50+
}
51+
52+
return $fbVersion
53+
}
54+
# </To be removed on removal of the ff fluent_bit_19>
55+
3356
Function GetFluentBitPluginVersion {
3457
$dir = "$scriptPath\..\..\embed"
3558

36-
$pluginVersion = $(Get-Content "$dir/fluent-bit.version" | %{if($_ -match "^windows") { $_.Split(',')[1]; }})
59+
$pluginVersion = $(Get-Content "$dir/fluent-bit.version" | %{if($_ -match "^windows,") { $_.Split(',')[1]; }})
3760
if ([string]::IsNullOrWhitespace($pluginVersion)) {
3861
throw "failed to read nr fluent-bit plugin version"
3962
}
@@ -42,9 +65,9 @@ Function GetFluentBitPluginVersion {
4265
}
4366
Function GetFluentBitVersion {
4467
$dir = "$scriptPath\..\..\embed"
45-
$fbVersion = $(Get-Content "$dir/fluent-bit.version" | %{if($_ -match "^windows") { $_.Split(',')[2]; }})
68+
$fbVersion = $(Get-Content "$dir/fluent-bit.version" | %{if($_ -match "^windows,") { $_.Split(',')[2]; }})
4669
if ([string]::IsNullOrWhitespace($fbVersion)) {
47-
throw "failed to read nr fluent-bit version"
70+
throw "failed to read nr fluent-bit 3.x version"
4871
}
4972

5073
return $fbVersion

cmd/newrelic-infra/newrelic-infra.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ func initializeAgentAndRun(c *config.Config, logFwCfg config.LogForward) error {
455455
os.Exit(1)
456456
}
457457

458+
fbVerbose := c.Log.Level == config.LogLevelTrace && c.Log.HasIncludeFilter(config.TracesFieldName, config.SupervisorTrace)
458459
confTempFolder := filepath.Join(c.AgentTempDir, v4.FbConfTempFolderNameDefault)
459460
fbIntCfg := v4.NewFBSupervisorConfig(
460461
ffManager,
@@ -464,7 +465,7 @@ func initializeAgentAndRun(c *config.Config, logFwCfg config.LogForward) error {
464465
c.FluentBitExePath,
465466
c.FluentBitNRLibPath,
466467
c.FluentBitParsersPath,
467-
logFwCfg.FluentBitVerbose,
468+
fbVerbose,
468469
confTempFolder,
469470
)
470471

internal/agent/cmdchannel/fflag/ffhandler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const (
2626
FlagProtocolV4 = "protocol_v4_enabled"
2727
FlagFullProcess = "full_process_sampling"
2828
FlagDmRegisterDeprecated = "dm_register_deprecated"
29-
FlagFluentBit19 = "fluent_bit_19"
29+
FlagFluentBit19 = "fluent_bit_19_win"
3030
// Config
3131
CfgYmlRegisterEnabled = "register_enabled"
3232
CfgYmlParallelizeInventory = "inventory_queue_len"

internal/agent/cmdchannel/fflag/ffhandler_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func TestSrv_InitialFetch_EnablesFb19(t *testing.T) {
310310
"name": "set_feature_flag",
311311
"arguments": {
312312
"category": "Infra_Agent",
313-
"flag": "fluent_bit_19",
313+
"flag": "fluent_bit_19_win",
314314
"enabled": true
315315
}
316316
}

pkg/integrations/v4/supervisor_fb_conf_linux.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ const (
1919
defaultFluentBitExecutable2 = "fluent-bit"
2020
)
2121

22-
func (c *fBSupervisorConfig) defaultLoggingBinDir(ffExists bool, ffEnabled bool) string {
23-
if (ffExists && ffEnabled) || onlyTdAgentInstalled() {
22+
func (c *fBSupervisorConfig) defaultLoggingBinDir(_ bool, _ bool) string {
23+
if onlyTdAgentInstalled() {
2424
return defaultLoggingBinDir1
2525
}
2626

2727
return defaultLoggingBinDir2
2828
}
2929

30-
func (c *fBSupervisorConfig) defaultFluentBitExePath(ffExists bool, ffEnabled bool, loggingBinDir string) string {
30+
func (c *fBSupervisorConfig) defaultFluentBitExePath(_ bool, _ bool, loggingBinDir string) string {
3131
defaultFluentBitExe := defaultFluentBitExecutable2
32-
if (ffExists && ffEnabled) || onlyTdAgentInstalled() {
32+
if onlyTdAgentInstalled() {
3333
defaultFluentBitExe = defaultFluentBitExecutable1
3434
}
3535

pkg/integrations/v4/supervisor_fb_conf_linux_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func Test_defaultLoggingBinDir(t *testing.T) {
4040
name: "enabled ff",
4141
ffExists: true,
4242
ffEnabled: true,
43-
expectedBinDir: "/opt/td-agent-bit/bin",
43+
expectedBinDir: "/opt/fluent-bit/bin",
4444
},
4545
}
4646

@@ -86,7 +86,7 @@ func Test_defaultFluentBitExePath(t *testing.T) {
8686
name: "enabled ff",
8787
ffExists: true,
8888
ffEnabled: true,
89-
expectedExePath: "/opt/td-agent-bit/bin/td-agent-bit",
89+
expectedExePath: "/opt/fluent-bit/bin/fluent-bit",
9090
},
9191
}
9292

pkg/integrations/v4/supervisor_fb_conf_windows.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "path/filepath"
88

99
const (
1010
// defaults for td-agent-bit (<=1.9).
11-
defaultLoggingBinDir1 = "logging"
11+
defaultLoggingBinDir1 = "logging-legacy"
1212
// defaults for fluent-bit (>=2.0).
1313
defaultLoggingBinDir2 = "logging"
1414
// both versions have the same name.

pkg/integrations/v4/supervisor_fb_conf_windows_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func Test_defaultLoggingBinDir(t *testing.T) {
4242
name: "enabled ff",
4343
ffExists: true,
4444
ffEnabled: true,
45-
expectedLoggingBinDir: "C:\\some\\agent\\dir\\integrations_dir\\logging",
45+
expectedLoggingBinDir: "C:\\some\\agent\\dir\\integrations_dir\\logging-legacy",
4646
},
4747
}
4848

@@ -90,7 +90,7 @@ func Test_defaultFluentBitExePath(t *testing.T) {
9090
name: "enabled ff",
9191
ffExists: true,
9292
ffEnabled: true,
93-
expectedExePath: "C:\\some\\agent\\dir\\integrations_dir\\logging\\fluent-bit.exe",
93+
expectedExePath: "C:\\some\\agent\\dir\\integrations_dir\\logging-legacy\\fluent-bit.exe",
9494
},
9595
}
9696

pkg/integrations/v4/supervisor_fb_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ func TestNewSupervisorConfig(t *testing.T) {
311311
integrationsDir: "integrationsDir",
312312
ffEnabled: true,
313313
ffExists: true,
314-
expectedPathLinux: filepath.Join("loggingBinDir", "td-agent-bit"),
314+
expectedPathLinux: filepath.Join("loggingBinDir", "fluent-bit"),
315315
expectedPathWindows: filepath.Join("loggingBinDir", "fluent-bit.exe"),
316316
},
317317
{
@@ -327,8 +327,8 @@ func TestNewSupervisorConfig(t *testing.T) {
327327
ffExists: true,
328328
integrationsDir: "integrationsDir",
329329
agentDir: "some_agent_dir",
330-
expectedPathLinux: filepath.Join("/opt/td-agent-bit/bin", "td-agent-bit"),
331-
expectedPathWindows: filepath.Join("some_agent_dir", "integrationsDir", "logging", "fluent-bit.exe"),
330+
expectedPathLinux: filepath.Join("/opt/fluent-bit/bin", "fluent-bit"),
331+
expectedPathWindows: filepath.Join("some_agent_dir", "integrationsDir", "logging-legacy", "fluent-bit.exe"),
332332
},
333333
}
334334

0 commit comments

Comments
 (0)