Possible to collect pod logs from all namespaces, or a selector of namespaces?

Reading through the docs on the pod logs collector spec: Pod Logs - Troubleshoot Docs - Troubleshoot Docs

It seems you can target a namespace via namespace but you cannot target multiple namespaces, or namespaces that you may not know the name of since they could be randomly generated.

Our product is beginning to act as a kubernetes operator and will create namespaces with randomized names that we would like to be able to include in a support bundle. These namespaces are labeled appropriately, so a label selector for the namespaces label would work great for our purposes.

Hey @bageldawg - I opened up a similar issue previously: Run Copy Collector Against Wildcard Namespaces

It’s not currently supported, but we’re looking for something very similar as we also dynamically create namespaces after the original install in the k8s cluster. I opened up an enhancement request for it.

1 Like

Had sometime to get back around to this, I’ve learned that this log collector will collect logs for pods in all namespace that contain the label if you have the means to add labels to the pods before taking the supportbundle:

---
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: swimlane-support-bundle
spec:
  collectors:
  - clusterInfo: {}
  - clusterResources: {}

  - logs:
      collectorName: cicd-logs
      selector:
      - troubleshoot.io/supportbundle=logs-collector
      name: cicd/logs
      limits:
        maxAge: 24h
1 Like