fix(parser): Add logging support for applications in services

This commit is contained in:
Leonid Zharikov
2025-03-29 23:08:43 +00:00
parent 4e80d8d550
commit c4ef08d419

View File

@@ -3175,6 +3175,13 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
} }
} }
$serviceAppsLogDrainEnabledMap = collect([]);
if ($resource instanceof Service) {
$serviceAppsLogDrainEnabledMap = $resource->applications()->get()->keyBy('name')->map(function ($app) {
return $app->isLogDrainEnabled();
});
}
// Parse the rest of the services // Parse the rest of the services
foreach ($services as $serviceName => $service) { foreach ($services as $serviceName => $service) {
$image = data_get_str($service, 'image'); $image = data_get_str($service, 'image');
@@ -3185,6 +3192,9 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
if ($resource instanceof Application && $resource->isLogDrainEnabled()) { if ($resource instanceof Application && $resource->isLogDrainEnabled()) {
$logging = generate_fluentd_configuration(); $logging = generate_fluentd_configuration();
} }
if ($resource instanceof Service && $serviceAppsLogDrainEnabledMap->get($serviceName)) {
$logging = generate_fluentd_configuration();
}
} }
$volumes = collect(data_get($service, 'volumes', [])); $volumes = collect(data_get($service, 'volumes', []));
$networks = collect(data_get($service, 'networks', [])); $networks = collect(data_get($service, 'networks', []));