Skip to content

Instantly share code, notes, and snippets.

@milesmatthias
Created January 4, 2020 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milesmatthias/cbf7b2656610a1c15630731c18d1cb5a to your computer and use it in GitHub Desktop.
Save milesmatthias/cbf7b2656610a1c15630731c18d1cb5a to your computer and use it in GitHub Desktop.
Stackdriver UI to gcloud command
#!/usr/bin/env ruby
# HOWTO:
# 1. Copy your filters from the SD log UI
# 2. Run `pbpaste | ruby sd_to_gcloud.rb`
query=[]
ARGF.each_line do |line|
query.push line.gsub("\n", "").gsub("\"", "")
end
print "gcloud logging read \"#{query.join(" AND ")}\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment