Skip to content

Instantly share code, notes, and snippets.

@rymcol
Created July 9, 2020 14:08
Show Gist options
  • Select an option

  • Save rymcol/fba53b7183020887d64abc6705e9dcfd to your computer and use it in GitHub Desktop.

Select an option

Save rymcol/fba53b7183020887d64abc6705e9dcfd to your computer and use it in GitHub Desktop.
just a handy fish function to make logs [app] [namespace] find a pod that matches metadata.app=[app] in [namespace] and produce logs for it
function logs
if test (count $argv) -ge 2
set app $argv[1]
set namespace $argv[2]
else
echo "You must provide two arguments… `logs [app] [namespace]`"
return 2
end
kubectl logs (kubectl get pods -l app=$app -o jsonpath="{.items[0].metadata.name}" -n $namespace) -n $namespace -f
end
@rymcol
Copy link
Author

rymcol commented Jul 9, 2020

In bash this would be something close to alias logs='kubectl logs (kubectl get pods -l app=$1 -o jsonpath="{.items[0].metadata.name}" -n $2) -n $2 -f'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment