Skip to content

Instantly share code, notes, and snippets.

@aeris
Created June 10, 2023 15:15
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 aeris/44b028d553922302967d5cc49951e59d to your computer and use it in GitHub Desktop.
Save aeris/44b028d553922302967d5cc49951e59d to your computer and use it in GitHub Desktop.
Mastodon Sidekiq parse error
#!/usr/bin/env ruby
require 'amazing_print'
ignores = [
/:in `/,
/Job raised exception/,
/WARN: Your Redis network connection is performing extremely poorly/,
/WARN: Mastodon::RaceConditionError/,
/Last RTT readings were/,
/If these values are close to/,
/CPU-saturated/,
/Ensure Redis is running in the same AZ or datacenter as Sidekiq/,
/WARN: ActiveRecord::ConnectionNotEstablished:/,
/Switching .* from green to red/,
/Switching .* from red to green/,
/WARN: ActiveRecord::RecordNotUnique/,
/Redis::TimeoutError: Connection timed out/,
/WARN: Seahorse::Client::NetworkingError:/,
/DETAIL: La clé/,
/Error storing media attachment:/,
/Error storing emoji: Net::ReadTimeout with/,
/^-- Journal begins at /,
/WARN: Aws::S3::MultipartUploadError:/,
/WARN: Aws::S3::Errors::InternalError/,
]
errors = [
/WARN: HTTP::TimeoutError: Connect timed out after \d+ seconds on (.*)$/,
/WARN: HTTP::TimeoutError: Read timed out after \d+ seconds on (.*)$/,
/WARN: Stoplight::Error::RedLight: (.*)$/,
/WARN: Mastodon::UnexpectedResponseError: (.*) returned code \d+$/,
/WARN: HTTP::ConnectionError: failed to connect: No address for .* on (.*)$/,
/WARN: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 peeraddr=.* state=error: certificate verify failed \(certificate has expired\) on (.*)/,
/WARN: OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 peeraddr=.* state=.* write client hello on (.*)$/,
/WARN: HTTP::ConnectionError: couldn't read response headers on (.*)/,
/WARN: HTTP::ConnectionError: failed to connect: Connection refused - connect\(2\) for .* on (.*)$/,
/WARN: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 peeraddr=.* state=error: sslv3 alert handshake failure on (.*)$/,
/WARN: HTTP::ConnectionError: failed to connect: No route to host - connect\(2\) for .* on (.*)$/,
/WARN: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 peeraddr=.* state=error: certificate verify failed \(self signed certificate\) on (.*)$/,
/WARN: HTTP::ConnectionError: failed to connect: Network is unreachable - connect\(2\) for .* on (.*)$/,
/WARN: HTTP::ConnectionError: failed to connect: Connection reset by peer - SSL_connect on (.*)$/
]
domains = []
IO.foreach '/tmp/sidekiq.log' do |line|
next if ignores.any? { _1.match line }
domain, _ = errors.collect do |error|
match = error.match line
match[1] if match
end.compact
unless domain
ap line
else
domains << domain
end
end
ap domains.tally.sort { _1.last <=> _2.last }.to_h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment