You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/10/05 16:57:42 UTC
[whimsy] branch master updated: Allow for some more error types
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 45c44f8 Allow for some more error types
45c44f8 is described below
commit 45c44f87182773c410185cf92b2b4eae7da0480d
Author: Sebb <se...@apache.org>
AuthorDate: Mon Oct 5 17:57:33 2020 +0100
Allow for some more error types
---
lib/whimsy/logparser.rb | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/lib/whimsy/logparser.rb b/lib/whimsy/logparser.rb
index 1203c0e..1017ae5 100755
--- a/lib/whimsy/logparser.rb
+++ b/lib/whimsy/logparser.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
+
# Gather simple statistics from whimsy server logs
# TODO security check ASF::Auth.decode before reading log files
require 'whimsy/asf'
@@ -179,12 +180,16 @@ module LogParser
# @param f filename of error.log or .gz
# @return hash of string of interesting entries
# "timestamp" => "AH01215: undefined method `map' for #<String:0x0000000240e1e0> (NoMethodError): /x1/srv/whimsy/www/status/errors.cgi"
+ # [..date..] [cgi:error] [pid ...] [client ...] End of script output before headers: site.cgi
+ # [..date..] [cgi:error] [pid ...] [client ...] AH01215: /var/lib/g...
+ # [..date..] [proxy:error] [pid ...] [client ...] AH00898: Error during SSL Handshake with remote server returned by /board/agenda/websocket/
+ # [..date..] [proxy:error] [pid ...] (20014)Internal error (specific information not available): [client ...] AH01084: pass request body failed to 127.0.0.1:34234 (localhost)
def parse_whimsy_error(f, logs = {})
- r = Regexp.new('\[(?<errdate>[^\]]*)\] \[cgi:error\] (\[([^\]]*)\] ){2}(?<errline>.+)')
+ r = Regexp.new('\[(?<errdate>[^\]]*)\] \[[\w_]+:error\] \[.+?\] (.+: )?\[.+?\] (?<errline>.+)')
ignored = Regexp.union(IGNORE_TRACEBACKS)
read_logz(f).lines.each do |l|
- if (m = r.match(l))
- if ignored !~ m[2]
+ r.match(l) do |m|
+ unless ignored =~ m[2]
begin
logs[DateTime.parse(m[1]).iso8601(6)] = m[2]
rescue StandardError
@@ -220,9 +225,11 @@ module LogParser
def get_errors(current, dir: ERROR_LOG_DIR)
if current
whimsy_log = latest(File.join(dir, 'whimsy_error.log*'))
+ puts whimsy_log
logs = LogParser.parse_whimsy_error(whimsy_log)
- error_log = latest(File.join(dir, 'error?log*'))
- LogParser.parse_error_log(error_log, logs) if error_log
+ # error_log = latest(File.join(dir, 'error?log*'))
+ # puts error_log
+ # LogParser.parse_error_log(error_log, logs) if error_log
else
logs = LogParser.parse_whimsy_errors(dir)
LogParser.parse_error_logs(dir, logs)