A Ruby Thor script that will parse a Google Logging URL and render to console with pull
or
to a log file and opened in editor with open
.
The default editor when ENV "EDITOR" is not set is VS CODE, so code
or ENV["EDITOR"]
should be in your ENV $PATH -- open
doesn't work with VIM as-is since the script
already has the console that vim will want to use.
Example use:
ruby logs.rb open "https://console.cloud.google.com/logs/viewer?advancedFilter=resource.type%3D%22k8s_container%22%0Aresource.labels.project_id%3D%22devops-foo%0Aresource.labels.location%3D%22us-central1%22%0Aresource.labels.cluster_name%3D%22ci-gke-cluster%22%0Aresource.labels.namespace_name%3D%22foobar%22%0Aresource.labels.pod_name%3D%22qa-9999-smzc5%22%0A&interval=NO_LIMIT&project=devops-foo"