77 "encoding/binary"
88 "fmt"
99 "github.com/docker/docker/api/types/container"
10+ filters2 "github.com/docker/docker/api/types/filters"
1011 "github.com/docker/docker/client"
1112 "github.com/docker/go-connections/nat"
1213 "github.com/google/uuid"
@@ -175,23 +176,6 @@ func (dc *DockerClient) copyToContainer(containerID, sourceFile, targetPath stri
175176 return nil
176177}
177178
178- func in (s string , substrings []string ) bool {
179- for _ , substr := range substrings {
180- if strings .Contains (s , substr ) {
181- return true
182- }
183- }
184- return false
185- }
186-
187- func isLocalToolDockerContainer (containerName string ) bool {
188- if in (containerName , []string {"/sig-provider" , "/stats" , "/stats-db" , "/db" , "/backend" , "/promtail" , "/compose" , "/blockscout" , "/frontend" , "/user-ops-indexer" , "/visualizer" , "/redis-db" , "/proxy" }) {
189- L .Debug ().Str ("Container" , containerName ).Msg ("Ignoring local tool container output" )
190- return true
191- }
192- return false
193- }
194-
195179// WriteAllContainersLogs writes all Docker container logs to the default logs directory
196180func WriteAllContainersLogs (dir string ) error {
197181 L .Info ().Msg ("Writing Docker containers logs" )
@@ -204,7 +188,13 @@ func WriteAllContainersLogs(dir string) error {
204188 if err != nil {
205189 return fmt .Errorf ("failed to create Docker provider: %w" , err )
206190 }
207- containers , err := provider .Client ().ContainerList (context .Background (), container.ListOptions {All : true })
191+ containers , err := provider .Client ().ContainerList (context .Background (), container.ListOptions {
192+ All : true ,
193+ Filters : filters2 .NewArgs (filters2.KeyValuePair {
194+ Key : "label" ,
195+ Value : "framework=ctf" ,
196+ }),
197+ })
208198 if err != nil {
209199 return fmt .Errorf ("failed to list Docker containers: %w" , err )
210200 }
@@ -214,9 +204,6 @@ func WriteAllContainersLogs(dir string) error {
214204 for _ , containerInfo := range containers {
215205 eg .Go (func () error {
216206 containerName := containerInfo .Names [0 ]
217- if isLocalToolDockerContainer (containerName ) {
218- return nil
219- }
220207 L .Debug ().Str ("Container" , containerName ).Msg ("Collecting logs" )
221208 logOptions := container.LogsOptions {ShowStdout : true , ShowStderr : true }
222209 logs , err := provider .Client ().ContainerLogs (context .Background (), containerInfo .ID , logOptions )
0 commit comments