bizside 2.3.5 → 2.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bizside/version.rb +1 -1
- metadata +2 -3
- data/lib/bizside/log_analyzer.rb +0 -122
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39b9880ea371f55ab17b2c82c67394a2f740bc612c4c9b69594db539d2e9b16f
|
4
|
+
data.tar.gz: b32b29653cc05e0332ff1bd51636ef2a750c8ccfbd6db608d7bc8ee6390df424
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64f122cfd9ad9ff1571b961e92733ff850015f1e2211c47e503705e1823bdce4334eab643fc10205369fa6ac345ee72491a6377d143a2f3092ade1394aa4e270
|
7
|
+
data.tar.gz: 6940e79997639635c66738ee8d19c6015447f3e187daa5d5e059009ccc5c784634a768f619a2cb0dc18c368cd1caf1486dc7ba79734ab94ca8456170f3ad70e1
|
data/lib/bizside/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bizside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bizside-developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -413,7 +413,6 @@ files:
|
|
413
413
|
- lib/bizside/implicit_ftps.rb
|
414
414
|
- lib/bizside/itamae_conf.rb
|
415
415
|
- lib/bizside/job_utils.rb
|
416
|
-
- lib/bizside/log_analyzer.rb
|
417
416
|
- lib/bizside/mailer.rb
|
418
417
|
- lib/bizside/query_builder.rb
|
419
418
|
- lib/bizside/railtie.rb
|
data/lib/bizside/log_analyzer.rb
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
module Bizside
|
2
|
-
class LogAnalyzer
|
3
|
-
attr_reader :add_on_name
|
4
|
-
attr_reader :error_contents
|
5
|
-
|
6
|
-
def initialize(add_on_name, files)
|
7
|
-
@add_on_name = add_on_name
|
8
|
-
@files = files
|
9
|
-
end
|
10
|
-
|
11
|
-
def analyze(output_file_name)
|
12
|
-
@success = system("request-log-analyzer --format rails3 --parse-strategy cautious --file #{output_file_name}.html --output HTML #{@files.join(' ')}")
|
13
|
-
end
|
14
|
-
|
15
|
-
def success?
|
16
|
-
@success
|
17
|
-
end
|
18
|
-
|
19
|
-
def scrape_errors
|
20
|
-
@error_content = String.new
|
21
|
-
@error_contents = {}
|
22
|
-
|
23
|
-
# TODO Okozeを解析できるようにする
|
24
|
-
return if add_on_name == 'okoze'
|
25
|
-
|
26
|
-
# TODO ログ内で重複したエラーメッセージを除外する
|
27
|
-
return if ['amadai', 'webcam_api', 'seri', 'sushioke'].include?(add_on_name)
|
28
|
-
|
29
|
-
@files.each do |file|
|
30
|
-
content = File.read(file, encoding: 'utf-8')
|
31
|
-
content = content.encode('UTF-16BE', 'UTF-8', :invalid => :replace, :undef => :replace, :replace => '?').encode('UTF-8')
|
32
|
-
next unless content.include?('Completed 500') or content.include?('FATAL')
|
33
|
-
|
34
|
-
# ログをプロセス単位に分割
|
35
|
-
partition_contents = divide_into_pid(content)
|
36
|
-
# プロセス単位に分割したログからエラーを抽出
|
37
|
-
partition_content_errors = extract_error_log(partition_contents)
|
38
|
-
# 抽出したエラーを出力用にまとめる
|
39
|
-
partition_content_errors.each do |pid, pc|
|
40
|
-
@error_contents[pid] = "#{file}のエラー抽出結果\n\n\n" if @error_contents[pid].nil? or @error_contents[pid].empty?
|
41
|
-
@error_contents[pid] << pc
|
42
|
-
end
|
43
|
-
|
44
|
-
@error_contents
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def divide_into_pid(content)
|
49
|
-
pid = nil
|
50
|
-
ret = {}
|
51
|
-
content.each_line do |c|
|
52
|
-
s = c.scan(/#[0-9]+\]/)
|
53
|
-
pid = s.first.scan(/[0-9]+/).first unless s.empty?
|
54
|
-
ret[pid] = "" unless ret[pid]
|
55
|
-
ret[pid] << c
|
56
|
-
end
|
57
|
-
|
58
|
-
ret
|
59
|
-
end
|
60
|
-
|
61
|
-
def extract_error_log(partition_contents)
|
62
|
-
ret = {}
|
63
|
-
partition_contents.each do |pid, pc|
|
64
|
-
tmp = ""
|
65
|
-
pc.each_line do |line|
|
66
|
-
unless line.scan(/: Started /).empty?
|
67
|
-
if !tmp.scan(/Completed 500/).empty? or !tmp.scan(/\] FATAL/).empty? or !tmp.scan(/\[FATAL\]/).empty?
|
68
|
-
ret[pid] = "" if ret[pid].nil? or ret[pid].empty?
|
69
|
-
ret[pid] << tmp
|
70
|
-
end
|
71
|
-
tmp.clear
|
72
|
-
end
|
73
|
-
tmp << exclude_error_log_line(line)
|
74
|
-
end
|
75
|
-
|
76
|
-
# Startedの前にログが終了した場合、その時点までにエラーが含まれていれば抽出に含める
|
77
|
-
if !tmp.empty? and !tmp.scan(/Completed 500/).empty? or !tmp.scan(/\] FATAL/).empty? or !tmp.scan(/\[FATAL\]/).empty?
|
78
|
-
ret[pid] = "" if ret[pid].nil? or ret[pid].empty?
|
79
|
-
ret[pid] << tmp
|
80
|
-
end
|
81
|
-
tmp.clear
|
82
|
-
end
|
83
|
-
|
84
|
-
ret
|
85
|
-
end
|
86
|
-
|
87
|
-
def exclude_error_log_line(line)
|
88
|
-
ret = nil
|
89
|
-
ret = line.match("INFO -- : ジョブ.*登録します。")
|
90
|
-
|
91
|
-
if ret.nil?
|
92
|
-
line
|
93
|
-
else
|
94
|
-
""
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
# TODO 重複したエラーログを除外する
|
99
|
-
def get_duplicate_check_line(line)
|
100
|
-
ret = line.scan(/(INFO -- :.*|ERROR -- :.*|WARN -- :.*|FATAL -- :.*)/).first
|
101
|
-
ret = ret.gsub(/\" for .*/, "\"") unless ret.nil or ret.empty?
|
102
|
-
|
103
|
-
ret
|
104
|
-
end
|
105
|
-
|
106
|
-
# TODO 重複したエラーログを除外する
|
107
|
-
def duplicate_error_log?(extract_error_logs, duplicate_check_lines)
|
108
|
-
res = false
|
109
|
-
extract_error_logs.each do |eer|
|
110
|
-
tmp = false
|
111
|
-
duplicate_check_lines.each do |dcl|
|
112
|
-
tmp = eer.include?(dcl)
|
113
|
-
break unless tmp
|
114
|
-
end
|
115
|
-
res = tmp
|
116
|
-
break if res
|
117
|
-
end
|
118
|
-
|
119
|
-
res
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|