Skip to main content

I got lazy and was sick of remembering or typing namespace and pod names. Enjoy.

 

get_all_pod_logs.ps1

#!pwsh
$all_pods = kubectl get pods --all-namespaces -o json | ConvertFrom-JSon
ForEach ($pod In $all_pods.items) {
$ns = $pod.metadata.namespace
$pod_name = $pod.metadata.name
ForEach ($container In $pod.spec.containers) {
$container_name = $container.name
$file_name = "$($ns)_$($pod_name)_$($container_name).log"
kubectl -n $ns logs $pod_name -c $container_name | Out-File $file_name
$file_name
}
}

 

Hi Kevin,

You can also use the mtctl dump for this. 

MTCTL - Middletier Controller - Technical Documentation For IFS Cloud

 

Thanks,

Kasun


Reply