Azure / WALinuxAgent

Microsoft Azure Linux Guest Agent
http://azure.microsoft.com/
Apache License 2.0
541 stars 372 forks source link

Capture logcollector pattern only once #3194

Closed maddieford closed 3 months ago

maddieford commented 3 months ago

Description

The log collector e2e test was failing due to capturing two log collector runs:

2024-08-27T08:29:28.196982Z INFO CollectLogsHandler ExtHandler Starting log collection... 2024-08-27T08:29:39.595852Z INFO MainThread LogCollector [CGI] Using cgroup v1 for resource enforcement and monitoring 2024-08-27T08:29:39.597196Z INFO MainThread LogCollector [CGI] cpu,cpuacct controller for cgroup: azure-walinuxagent-logcollector [/sys/fs/cgroup/cpu,cpuacct/azure.slice/azure-walinuxagent.slice/azure-walinuxagent-logcollector.slice/collect-logs.scope] 2024-08-27T08:29:39.597349Z INFO MainThread LogCollector [CGI] memory controller for cgroup: azure-walinuxagent-logcollector [/sys/fs/cgroup/memory/azure.slice/azure-walinuxagent.slice/azure-walinuxagent-logcollector.slice/collect-logs.scope] 2024-08-27T08:29:40.893991Z INFO MainThread LogCollector Log collection successfully completed. Archive can be found at /var/lib/waagent/logcollector/logs.zip and detailed log output can be found at /var/lib/waagent/logcollector/results.txt 2024-08-27T08:29:42.497298Z INFO CollectLogsHandler ExtHandler Successfully collected logs. Archive size: 118167 b, elapsed time: 14300 ms. 2024-08-27T08:29:42.515656Z INFO CollectLogsHandler ExtHandler Successfully uploaded logs. 2024-08-27T08:38:24.831219Z INFO CollectLogsHandler ExtHandler Starting log collection... 2024-08-27T08:38:36.095471Z INFO MainThread LogCollector [CGI] Using cgroup v1 for resource enforcement and monitoring 2024-08-27T08:38:36.096962Z INFO MainThread LogCollector [CGI] cpu,cpuacct controller for cgroup: azure-walinuxagent-logcollector [/sys/fs/cgroup/cpu,cpuacct/azure.slice/azure-walinuxagent.slice/azure-walinuxagent-logcollector.slice/collect-logs.scope] 2024-08-27T08:38:36.097165Z INFO MainThread LogCollector [CGI] memory controller for cgroup: azure-walinuxagent-logcollector [/sys/fs/cgroup/memory/azure.slice/azure-walinuxagent.slice/azure-walinuxagent-logcollector.slice/collect-logs.scope] 2024-08-27T08:38:37.897544Z INFO MainThread LogCollector Log collection successfully completed. Archive can be found at /var/lib/waagent/logcollector/logs.zip and detailed log output can be found at /var/lib/waagent/logcollector/results.txt 2024-08-27T08:38:39.098655Z INFO CollectLogsHandler ExtHandler Successfully collected logs. Archive size: 268338 b, elapsed time: 14267 ms. 2024-08-27T08:38:39.119142Z INFO CollectLogsHandler ExtHandler Successfully uploaded logs.!

This PR updates the command to take the first matching pattern

Issue #


PR information

Quality of Code and Contribution Guidelines