Skip to content

Instantly share code, notes, and snippets.

@srt32
Last active November 8, 2022 19:56
Show Gist options
  • Save srt32/89a5593007355081e77ad0efa27fc0a6 to your computer and use it in GitHub Desktop.
Save srt32/89a5593007355081e77ad0efa27fc0a6 to your computer and use it in GitHub Desktop.
parse the JSONL export from honeybadger.io
# usage: cat ~/Downloads/log_foo-bar-baz.jsonl | ruby honeybadger_parser.rb
require 'json'
data = ARGF.read
lines = data.split("\n")
grouped = lines.group_by do |line|
JSON.parse(line)["request"]["context"]["project_id"]
end
grouped_list = {}
grouped.map {|project_id, list| grouped_list[project_id] = list.size }
puts(grouped_list)
# usage: cat ~/Downloads/log_foo-bar-baz.jsonl | ruby paypal_error_parser.rb
require 'json'
data = ARGF.read
lines = data.split("\n")
grouped = lines.map do |line|
JSON.parse(line)["request"]["context"]["cancel_url"]
end
puts(grouped.uniq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment