We have created a script which you would need to call just once to correctly setup FluentBit for log pipelining.
To use the script, just run:
.\Deploy-FluentBit.ps1 `
-CtrlBHost "10.91.27.4" `
-CtrlBPort "5080" `
-CtrlBStreamName "test_qa" `
-CtrlBAuthHeader "Authorization Basic <key>" `
-LogPaths @("C:\ProgramData\GuestConfig", "D:\c-base\logs") `
-MaxDirectoryDepth 4 `
-ProcessGzipFiles `
-GzipBatchSize 3
-DeepClean `
-CleanInstall `The key points to note here are:
-LogPathsaccept an array of directories within which.logfiles will be tracked.GzipPathsaccept an array of directories within which.gzfiles will be tracked.MaxDirectoryDepthindicates the max depth FluentBit will go recursively into to search for the.logand.gzfiles.
Do note this FluentBit is going to be deployed as a Windows Service, running in the background. To check its status, go to localhost:2020/api/v1/metrics.
Logs of FluentBit can be found using this command: Get-Content "C:\temp\logs\fluent-bit.log" -Tail 20 -Wait .
Also, this FluentBit service will track SQL Server logs from the default location. It will only track the ERRORLOG file contents.
The deploy script is now idempotent as long as you use the -DeepClean and -CleanInstall flags.
- Remember to run Powershell in Administrator mode.
- Powershell does not allow running of scripts by default. You might need to do:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Processand then Yes to All [A] to be able to run scripts.
To track the logs of FluentBit:
& 'C:\temp\logs\monitor-fluent-bit.ps1'