From 479c2743bd438461b9b00f883cc165e2f77e873b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 17 Nov 2023 10:50:02 +0100 Subject: [PATCH] Update Fluent Bit configuration file --- app/Actions/Server/InstallLogDrain.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/Actions/Server/InstallLogDrain.php b/app/Actions/Server/InstallLogDrain.php index e4e43dc1b..5ea1d5e43 100644 --- a/app/Actions/Server/InstallLogDrain.php +++ b/app/Actions/Server/InstallLogDrain.php @@ -26,6 +26,8 @@ public function handle(Server $server, string $type) Flush 5 Daemon off Tag container_logs + Log_Level debug + Parsers_File parsers.conf [INPUT] Name forward Buffer_Chunk_Size 1M @@ -38,7 +40,6 @@ public function handle(Server $server, string $type) Name modify Match * Set server_name {$server->name} - [OUTPUT] Name nrlogs Match * @@ -53,9 +54,10 @@ public function handle(Server $server, string $type) } $config = base64_encode(" [SERVICE] - Flush 1 + Flush 5 Daemon off Log_Level debug + Parsers_File parsers.conf [INPUT] Name forward tag \${HIGHLIGHT_PROJECT_ID} @@ -75,6 +77,8 @@ public function handle(Server $server, string $type) [SERVICE] Flush 5 Daemon off + Log_Level debug + Parsers_File parsers.conf [INPUT] Name forward Buffer_Chunk_Size 1M @@ -104,7 +108,12 @@ public function handle(Server $server, string $type) } else { throw new \Exception('Unknown log drain type.'); } - + $parsers = base64_encode(" +[PARSER] + Name empty_line_skipper + Format regex + Regex /^(?!\s*$).+/ +"); $compose = base64_encode(" services: coolify-log-drain: @@ -115,6 +124,7 @@ public function handle(Server $server, string $type) - .env volumes: - ./fluent-bit.conf:/fluent-bit.conf + - ./parsers.conf:/parsers.conf ports: - 127.0.0.1:24224:24224 "); @@ -132,11 +142,13 @@ public function handle(Server $server, string $type) $config_path = $base_path . '/log-drains'; $fluent_bit_config = $config_path . '/fluent-bit.conf'; + $parsers_config = $config_path . '/parsers.conf'; $compose_path = $config_path . '/docker-compose.yml'; $readme_path = $config_path . '/README.md'; $command = [ "echo 'Saving configuration'", "mkdir -p $config_path", + "echo '{$parsers}' | base64 -d > $parsers_config", "echo '{$config}' | base64 -d > $fluent_bit_config", "echo '{$compose}' | base64 -d > $compose_path", "echo '{$readme}' | base64 -d > $readme_path",