diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index e67a43e46..55dbefedd 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -837,14 +837,6 @@ private function generate_compose_file() 'networks' => [ $this->destination->network, ], - 'logging' => [ - 'driver' => 'fluentd', - 'options' => [ - 'fluentd-address' => "tcp://127.0.0.1:24224", - 'fluentd-async' => "true", - 'fluentd-sub-second-precision' => "true", - ] - ], 'healthcheck' => [ 'test' => [ 'CMD-SHELL', @@ -872,6 +864,17 @@ private function generate_compose_file() ] ] ]; + ray($this->server->isDrainLogActivated()); + if ($this->server->isDrainLogActivated()) { + $docker_compose['services'][$this->container_name]['logging'] = [ + 'driver' => 'fluentd', + 'options' => [ + 'fluentd-address' => "tcp://127.0.0.1:24224", + 'fluentd-async' => "true", + 'fluentd-sub-second-precision' => "true", + ] + ]; + } if ($this->application->isHealthcheckDisabled()) { data_forget($docker_compose, 'services.' . $this->container_name . '.healthcheck'); } diff --git a/app/Models/Server.php b/app/Models/Server.php index 83df8d61a..788808430 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -308,6 +308,9 @@ public function isFunctional() { return $this->settings->is_reachable && $this->settings->is_usable; } + public function isDrainLogActivated() { + return $this->settings->is_logdrain_newrelic_enabled || $this->settings->is_logdrain_highlight_enabled || $this->settings->is_logdrain_axiom_enabled; + } public function validateConnection() { $uptime = instant_remote_process(['uptime'], $this, false);