fluent-diagtool 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -1
- data/README.md +17 -3
- data/fluent-diagtool.gemspec +2 -2
- data/lib/fluent/diagtool/collectutils.rb +36 -12
- data/lib/fluent/diagtool/diagutils.rb +21 -12
- data/lib/fluent/diagtool/maskutils.rb +15 -5
- data/lib/fluent/diagtool/validutils.rb +2 -0
- data/lib/fluent/diagtool/version.rb +1 -1
- metadata +5 -6
- data/bin/diagtool.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cec6d985c53b3d147c6d1eb5418ae15983b1bf2ec1bcd15f6c4c035f20a93cf3
|
4
|
+
data.tar.gz: b58b0565d227ccc1f99d0dc3fbb482e03b1cb5faf38c9a5326fe753f0a222efc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1f5582d4f9835d158f09ee7256771406cf57c8753b6de9170c68d5b4f774ebb7397fce7fe70c8d247eb92bedf9f46a6af6f575b783a4718323b48a2a824b521
|
7
|
+
data.tar.gz: 139b59e1c25cd34e745ba799d5c323c18421d3f5b4b95fbf9c59c63b75291e6663ee9a5cb43cb3cb8ac75ea99a1a495b6c3f9b731960643a93df0fc09e3ddfc1
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fluent-diagtool (0.1.
|
4
|
+
fluent-diagtool (0.1.2)
|
5
|
+
fileutils (~> 1.0.2)
|
6
|
+
json (~> 2.1.0)
|
5
7
|
|
6
8
|
GEM
|
7
9
|
remote: https://rubygems.org/
|
8
10
|
specs:
|
9
11
|
diff-lcs (1.3)
|
12
|
+
fileutils (1.0.2)
|
13
|
+
json (2.1.0)
|
10
14
|
rake (12.3.3)
|
11
15
|
rspec (3.9.0)
|
12
16
|
rspec-core (~> 3.9.0)
|
data/README.md
CHANGED
@@ -22,10 +22,24 @@ The scope of data collection:<br>
|
|
22
22
|
## Prerequisite
|
23
23
|
|
24
24
|
|
25
|
+
## Installation
|
26
|
+
|
27
|
+
```
|
28
|
+
# gem install fluent-diagtool
|
29
|
+
Fetching: fileutils-1.0.2.gem (100%)
|
30
|
+
Successfully installed fileutils-1.0.2
|
31
|
+
Fetching: json-2.1.0.gem (100%)
|
32
|
+
Building native extensions. This could take a while...
|
33
|
+
Successfully installed json-2.1.0
|
34
|
+
Fetching: fluent-diagtool-0.1.2.gem (100%)
|
35
|
+
Successfully installed fluent-diagtool-0.1.2
|
36
|
+
3 gems installed
|
37
|
+
```
|
38
|
+
|
25
39
|
## Usage
|
26
40
|
```
|
27
|
-
#
|
28
|
-
Usage: diagtool
|
41
|
+
# diagtool --help
|
42
|
+
Usage: /usr/local/bin/diagtool -o OUTPUT_DIR -m {yes | no} -w {word1,[word2...]} -f {listfile} -s {hash seed}
|
29
43
|
-o, --output DIR Output directory (Mandatory)
|
30
44
|
-m, --mask yes|no Enable mask function (Optional : Default=no)
|
31
45
|
-w, --word-list word1,word2 Provide a list of user-defined words which will to be masked (Optional : Default=None)
|
@@ -43,7 +57,7 @@ NOTE: When user specified the keywork, only the exact match words will be masked
|
|
43
57
|
|
44
58
|
#### Command sample:
|
45
59
|
```
|
46
|
-
#
|
60
|
+
# diagtool -o /tmp/work1 -w passwd1,passwd2 -f word_list_sample -m yes
|
47
61
|
2020-05-12 18:21:19 -0400: [Diagtool] [INFO] Parsing command options...
|
48
62
|
2020-05-12 18:21:19 -0400: [Diagtool] [INFO] Option : Output directory = /tmp/work1
|
49
63
|
2020-05-12 18:21:19 -0400: [Diagtool] [INFO] Option : Mask = yes
|
data/fluent-diagtool.gemspec
CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_runtime_dependency("fileutils", ["~> 1.0
|
23
|
-
spec.add_runtime_dependency("json", ["~> 2.1
|
22
|
+
spec.add_runtime_dependency("fileutils", ["~> 1.0"])
|
23
|
+
spec.add_runtime_dependency("json", ["~> 2.1"])
|
24
24
|
end
|
@@ -25,9 +25,10 @@ module Diagtool
|
|
25
25
|
"#{datetime}: [Diagutils] [#{severity}] #{msg}\n"
|
26
26
|
})
|
27
27
|
@time_format = conf[:time]
|
28
|
-
@
|
28
|
+
@basedir = conf[:basedir]
|
29
29
|
@workdir = conf[:workdir]
|
30
|
-
|
30
|
+
@outdir = conf[:outdir]
|
31
|
+
|
31
32
|
@tdenv = get_tdenv()
|
32
33
|
@tdconf = @tdenv['FLUENT_CONF'].split('/')[-1]
|
33
34
|
@tdconf_path = @tdenv['FLUENT_CONF'].gsub(@tdconf,'')
|
@@ -48,6 +49,7 @@ module Diagtool
|
|
48
49
|
@logger.info(" td-agent log path = #{@tdlog_path}")
|
49
50
|
@logger.info(" td-agent log = #{@tdlog}")
|
50
51
|
end
|
52
|
+
|
51
53
|
def get_osenv()
|
52
54
|
stdout, stderr, status = Open3.capture3('hostnamectl')
|
53
55
|
os_dict = {}
|
@@ -60,6 +62,7 @@ module Diagtool
|
|
60
62
|
end
|
61
63
|
return os_dict
|
62
64
|
end
|
65
|
+
|
63
66
|
def get_tdenv()
|
64
67
|
stdout, stderr, status = Open3.capture3('systemctl cat td-agent')
|
65
68
|
env_dict = {}
|
@@ -73,6 +76,7 @@ module Diagtool
|
|
73
76
|
end
|
74
77
|
return env_dict
|
75
78
|
end
|
79
|
+
|
76
80
|
def export_env()
|
77
81
|
env = {
|
78
82
|
:os => @osenv['Operating System'],
|
@@ -84,60 +88,78 @@ module Diagtool
|
|
84
88
|
}
|
85
89
|
return env
|
86
90
|
end
|
91
|
+
|
87
92
|
def collect_tdconf()
|
88
93
|
FileUtils.mkdir_p(@workdir+@tdconf_path)
|
89
94
|
FileUtils.cp(@tdconf_path+@tdconf, @workdir+@tdconf_path)
|
90
95
|
return @workdir+@tdconf_path+@tdconf
|
91
96
|
end
|
97
|
+
|
92
98
|
def collect_tdlog()
|
93
99
|
FileUtils.mkdir_p(@workdir+@tdlog_path)
|
94
100
|
FileUtils.cp_r(@tdlog_path, @workdir+@oslog_path)
|
95
101
|
return Dir.glob(@workdir+@tdlog_path+@tdlog+'*')
|
96
102
|
end
|
103
|
+
|
97
104
|
def collect_sysctl()
|
98
105
|
FileUtils.mkdir_p(@workdir+@sysctl_path)
|
99
106
|
FileUtils.cp(@sysctl_path+@sysctl, @workdir+@sysctl_path)
|
100
107
|
return @workdir+@sysctl_path+@sysctl
|
101
108
|
end
|
109
|
+
|
102
110
|
def collect_oslog()
|
103
111
|
FileUtils.mkdir_p(@workdir+@oslog_path)
|
104
112
|
FileUtils.cp(@oslog_path+@oslog, @workdir+@oslog_path)
|
105
113
|
return @workdir+@oslog_path+@oslog
|
106
114
|
end
|
115
|
+
|
107
116
|
def collect_ulimit()
|
108
|
-
output = @
|
117
|
+
output = @outdir+'/ulimit_n.output'
|
109
118
|
stdout, stderr, status = Open3.capture3("ulimit -n")
|
110
119
|
File.open(output, 'w') do |f|
|
111
120
|
f.puts(stdout)
|
112
121
|
end
|
113
122
|
return output
|
114
123
|
end
|
124
|
+
|
125
|
+
def collect_ps_eo()
|
126
|
+
output = @outdir+'/ps_eo.output'
|
127
|
+
stdout, stderr, status = Open3.capture3("ps -eo pid,ppid,stime,time,%mem,%cpu,cmd")
|
128
|
+
File.open(output, 'w') do |f|
|
129
|
+
f.puts(stdout)
|
130
|
+
end
|
131
|
+
return output
|
132
|
+
end
|
133
|
+
|
115
134
|
def collect_meminfo()
|
116
|
-
output = @
|
135
|
+
output = @outdir+'/meminfo.output'
|
117
136
|
stdout, stderr, status = Open3.capture3("cat /proc/meminfo")
|
118
137
|
File.open(output, 'w') do |f|
|
119
138
|
f.puts(stdout)
|
120
139
|
end
|
121
140
|
return output
|
122
141
|
end
|
123
|
-
|
124
|
-
|
125
|
-
|
142
|
+
|
143
|
+
def collect_netstat_plan()
|
144
|
+
output = @outdir+'/netstat_plan.output'
|
145
|
+
stdout, stderr, status = Open3.capture3("netstat -plan")
|
126
146
|
File.open(output, 'w') do |f|
|
127
147
|
f.puts(stdout)
|
128
148
|
end
|
129
149
|
return output
|
130
150
|
end
|
151
|
+
|
131
152
|
def collect_netstat_s()
|
132
|
-
output = @
|
153
|
+
output = @outdir+'/netstat_s.output'
|
133
154
|
stdout, stderr, status = Open3.capture3("netstat -s")
|
134
155
|
File.open(output, 'w') do |f|
|
135
156
|
f.puts(stdout)
|
136
157
|
end
|
137
158
|
return output
|
138
159
|
end
|
160
|
+
|
139
161
|
def collect_ntp(command)
|
140
|
-
output = @
|
162
|
+
output = @outdir+'/ntp_info.output'
|
141
163
|
stdout_date, stderr_date, status_date = Open3.capture3("date")
|
142
164
|
stdout_ntp, stderr_ntp, status_ntp = Open3.capture3("chronyc sources") if command == "chrony"
|
143
165
|
stdout_ntp, stderr_ntp, status_ntp = Open3.capture3("ntpq -p") if command == "ntp"
|
@@ -147,19 +169,21 @@ module Diagtool
|
|
147
169
|
end
|
148
170
|
return output
|
149
171
|
end
|
172
|
+
|
150
173
|
def collect_tdgems()
|
151
|
-
output = @
|
174
|
+
output = @outdir+'/tdgem_list.output'
|
152
175
|
stdout, stderr, status = Open3.capture3("td-agent-gem list | grep fluent")
|
153
176
|
File.open(output, 'w') do |f|
|
154
177
|
f.puts(stdout)
|
155
178
|
end
|
156
179
|
return output
|
157
180
|
end
|
181
|
+
|
158
182
|
def compress_output()
|
159
|
-
Dir.chdir(@
|
183
|
+
Dir.chdir(@basedir)
|
160
184
|
tar_file = 'diagout-'+@time_format+'.tar.gz'
|
161
185
|
stdout, stderr, status = Open3.capture3("tar cvfz #{tar_file} #{@time_format}")
|
162
|
-
return @
|
186
|
+
return @basedir + '/' + tar_file
|
163
187
|
end
|
164
188
|
end
|
165
189
|
end
|
@@ -28,8 +28,12 @@ module Diagtool
|
|
28
28
|
@time_format = time.strftime("%Y%m%d%0k%M%0S")
|
29
29
|
@conf = parse_diagconf(params)
|
30
30
|
@conf[:time] = @time_format
|
31
|
-
@conf[:workdir] = @conf[:
|
31
|
+
@conf[:workdir] = @conf[:basedir] + '/' + @time_format
|
32
|
+
@conf[:outdir] = @conf[:workdir] + '/output'
|
33
|
+
|
32
34
|
FileUtils.mkdir_p(@conf[:workdir])
|
35
|
+
FileUtils.mkdir_p(@conf[:outdir])
|
36
|
+
|
33
37
|
diaglog = @conf[:workdir] + '/diagtool.output'
|
34
38
|
@masklog = './mask_' + @time_format + '.json'
|
35
39
|
@logger = Logger.new(STDOUT, formatter: proc {|severity, datetime, progname, msg|
|
@@ -39,11 +43,12 @@ module Diagtool
|
|
39
43
|
"#{datetime}: [Diagtool] [#{severity}] #{msg}\n"
|
40
44
|
})
|
41
45
|
diaglogger_info("Parsing command options...")
|
42
|
-
diaglogger_info(" Option : Output directory = #{@conf[:
|
46
|
+
diaglogger_info(" Option : Output directory = #{@conf[:basedir]}")
|
43
47
|
diaglogger_info(" Option : Mask = #{@conf[:mask]}")
|
44
48
|
diaglogger_info(" Option : Word list = #{@conf[:words]}")
|
45
49
|
diaglogger_info(" Option : Hash Seed = #{@conf[:seed]}")
|
46
50
|
end
|
51
|
+
|
47
52
|
def diagtool()
|
48
53
|
loglevel = 'WARN'
|
49
54
|
diaglogger_info("Initializing parameters...")
|
@@ -78,10 +83,14 @@ module Diagtool
|
|
78
83
|
oslog = m.mask_tdlog(oslog, clean = true)
|
79
84
|
end
|
80
85
|
diaglogger_info("[Collect] config file is stored in #{oslog}")
|
81
|
-
|
86
|
+
|
87
|
+
diaglogger_info("[Collect] Collecting process information...")
|
88
|
+
meminfo = c.collect_ps_eo()
|
89
|
+
diaglogger_info("[Collect] process informationis stored in #{meminfo}")
|
90
|
+
|
82
91
|
diaglogger_info("[Collect] Collecting OS memory information...")
|
83
92
|
meminfo = c.collect_meminfo()
|
84
|
-
diaglogger_info("[Collect]
|
93
|
+
diaglogger_info("[Collect] OS memory information is stored in #{meminfo}")
|
85
94
|
|
86
95
|
diaglogger_info("[Collect] Collecting date/time information...")
|
87
96
|
if system('which chronyc > /dev/null 2>&1')
|
@@ -95,7 +104,7 @@ module Diagtool
|
|
95
104
|
|
96
105
|
diaglogger_info("[Collect] Collecting netstat information...")
|
97
106
|
if system('which netstat > /dev/null 2>&1')
|
98
|
-
netstat_n = c.
|
107
|
+
netstat_n = c.collect_netstat_plan()
|
99
108
|
netstat_s = c.collect_netstat_s()
|
100
109
|
if @conf[:mask] == 'yes'
|
101
110
|
diaglogger_info("[Mask] Masking netstat file : #{netstat_n}...")
|
@@ -158,17 +167,13 @@ module Diagtool
|
|
158
167
|
|
159
168
|
def parse_diagconf(params)
|
160
169
|
options = {
|
161
|
-
:
|
162
|
-
:mask => 'no',
|
163
|
-
:words => [],
|
164
|
-
:wfile => '',
|
165
|
-
:seed => ''
|
170
|
+
:basedir => '', :mask => '', :words => [], :wfile => '', :seed => ''
|
166
171
|
}
|
167
172
|
if params[:output] != nil
|
168
173
|
if Dir.exist?(params[:output])
|
169
|
-
options[:
|
174
|
+
options[:basedir] = params[:output]
|
170
175
|
else
|
171
|
-
raise "output directory '#{
|
176
|
+
raise "output directory '#{basedir}' does not exist"
|
172
177
|
end
|
173
178
|
else
|
174
179
|
raise "output directory '-o' must be specified"
|
@@ -197,18 +202,22 @@ module Diagtool
|
|
197
202
|
options[:seed] = params[:"hash-seed"] if params[:"hash-seed"] != nil
|
198
203
|
return options
|
199
204
|
end
|
205
|
+
|
200
206
|
def diaglogger_debug(str)
|
201
207
|
@logger.debug(str)
|
202
208
|
@logger_file.debug(str)
|
203
209
|
end
|
210
|
+
|
204
211
|
def diaglogger_info(str)
|
205
212
|
@logger.info(str)
|
206
213
|
@logger_file.info(str)
|
207
214
|
end
|
215
|
+
|
208
216
|
def diaglogger_warn(str)
|
209
217
|
@logger.warn(str)
|
210
218
|
@logger_file.warn(str)
|
211
219
|
end
|
220
|
+
|
212
221
|
def diaglogger_error(str)
|
213
222
|
@logger.error(str)
|
214
223
|
@logger_file.error(str)
|
@@ -29,13 +29,10 @@ module Diagtool
|
|
29
29
|
})
|
30
30
|
@logger.debug("Initialize Maskutils: sanitized word = #{conf[:words]}")
|
31
31
|
@hash_seed = conf[:seed]
|
32
|
-
@id = {
|
33
|
-
:fid =>'',
|
34
|
-
:lid =>'',
|
35
|
-
:cid =>''
|
36
|
-
}
|
32
|
+
@id = {}
|
37
33
|
@masklog = Hash.new { |h,k| h[k] = Hash.new(&h.default_proc) }
|
38
34
|
end
|
35
|
+
|
39
36
|
def mask_tdlog(input_file, clean)
|
40
37
|
line_id = 0
|
41
38
|
f = File.open(input_file+'.mask', 'w')
|
@@ -51,6 +48,7 @@ module Diagtool
|
|
51
48
|
FileUtils.rm(input_file) if clean == true
|
52
49
|
return input_file+'.mask'
|
53
50
|
end
|
51
|
+
|
54
52
|
def mask_tdlog_gz(input_file, clean)
|
55
53
|
line_id = 0
|
56
54
|
f = File.open(input_file+'.mask', 'w')
|
@@ -68,6 +66,7 @@ module Diagtool
|
|
68
66
|
FileUtils.rm(input_file) if clean == true
|
69
67
|
return input_file+'.mask'
|
70
68
|
end
|
69
|
+
|
71
70
|
def mask_tdlog_inspector(line)
|
72
71
|
i = 0
|
73
72
|
contents=[]
|
@@ -157,6 +156,7 @@ module Diagtool
|
|
157
156
|
@logger.debug("Masked Line: #{line_masked}")
|
158
157
|
return line_masked
|
159
158
|
end
|
159
|
+
|
160
160
|
def mask_direct_pattern(str)
|
161
161
|
is_mask = false
|
162
162
|
if str.include?(">")
|
@@ -173,6 +173,7 @@ module Diagtool
|
|
173
173
|
end
|
174
174
|
return is_mask, str_mask
|
175
175
|
end
|
176
|
+
|
176
177
|
def mask_url_pattern(str)
|
177
178
|
is_mask = false
|
178
179
|
url = str.split('://')
|
@@ -215,6 +216,7 @@ module Diagtool
|
|
215
216
|
str_mask << ":" if str.end_with?(':')
|
216
217
|
return is_mask, str_mask
|
217
218
|
end
|
219
|
+
|
218
220
|
def mask_equal_pattern(str)
|
219
221
|
is_mask = false
|
220
222
|
l = str.split('=') ## Mask host=<address:ip/hostname> or bind=<address: ip/hostname>
|
@@ -228,6 +230,7 @@ module Diagtool
|
|
228
230
|
str_mask = l.join('=')
|
229
231
|
return is_mask, str_mask
|
230
232
|
end
|
233
|
+
|
231
234
|
def mask_colon_pattern(str)
|
232
235
|
is_mask = false
|
233
236
|
l = str.split(':')
|
@@ -242,6 +245,7 @@ module Diagtool
|
|
242
245
|
str_mask << ":" if str.end_with?(':')
|
243
246
|
return is_mask, str_mask
|
244
247
|
end
|
248
|
+
|
245
249
|
def mask_slash_pattern(str)
|
246
250
|
is_mask = false
|
247
251
|
l = str.split('/')
|
@@ -256,14 +260,17 @@ module Diagtool
|
|
256
260
|
str_mask << ":" if str.end_with?(':')
|
257
261
|
return is_mask, str_mask
|
258
262
|
end
|
263
|
+
|
259
264
|
def is_ipv4?(str)
|
260
265
|
!!(str =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)
|
261
266
|
end
|
267
|
+
|
262
268
|
def is_fqdn?(str)
|
263
269
|
#!!(str =~ /^\b((?=[a-z0-9-]{1,63}\.)[a-z0-9]+(-[a-z0-9]+)*\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/)
|
264
270
|
!!(str =~ /^\b(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.){2,}([A-Za-z]|[A-Za-z][A-Za-z\-]*[A-Za-z]){2,}$/)
|
265
271
|
#!!(str =~ /^\b(?=^.{1,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)/)
|
266
272
|
end
|
273
|
+
|
267
274
|
def is_words?(str)
|
268
275
|
value = false
|
269
276
|
@words.each do | l |
|
@@ -274,6 +281,7 @@ module Diagtool
|
|
274
281
|
end
|
275
282
|
return value
|
276
283
|
end
|
284
|
+
|
277
285
|
def mask_ipv4_fqdn_words(str)
|
278
286
|
str = str.to_s
|
279
287
|
mtype = ''
|
@@ -299,11 +307,13 @@ module Diagtool
|
|
299
307
|
end
|
300
308
|
return is_mask, str, str_mask
|
301
309
|
end
|
310
|
+
|
302
311
|
def put_masklog(str, str_mask)
|
303
312
|
uid = "Line#{@id[:lid]}-#{@id[:cid]}"
|
304
313
|
@masklog[@id[:fid]][uid]['original'] = str
|
305
314
|
@masklog[@id[:fid]][uid]['mask'] = str_mask
|
306
315
|
end
|
316
|
+
|
307
317
|
def export_masklog(output_file)
|
308
318
|
masklog_json = JSON.pretty_generate(@masklog)
|
309
319
|
File.open(output_file, 'w') do |f|
|
@@ -38,6 +38,7 @@ module Diagtool
|
|
38
38
|
@logger.debug(" Default ulimit: #{@def_ulimit}")
|
39
39
|
@logger.debug(" Default sysctl: #{@def_sysctl}")
|
40
40
|
end
|
41
|
+
|
41
42
|
def valid_ulimit(ulimit_file)
|
42
43
|
@logger.info("Loading ulimit file: #{ulimit_file}")
|
43
44
|
File.readlines(ulimit_file).each { |line|
|
@@ -50,6 +51,7 @@ module Diagtool
|
|
50
51
|
end
|
51
52
|
}
|
52
53
|
end
|
54
|
+
|
53
55
|
def valid_sysctl(sysctl_file)
|
54
56
|
h = Hash.new()
|
55
57
|
v = Hash.new { |i,j| i[j] = Hash.new(&h.default_proc) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-diagtool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kubotat
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.1
|
33
|
+
version: '2.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.1
|
40
|
+
version: '2.1'
|
41
41
|
description: Bringing productivity of trouble shooting to the next level by automating
|
42
42
|
collection of Fluentd configurations, settings and OS parameters as well as masking
|
43
43
|
sensitive information in logs and configurations.
|
@@ -55,7 +55,6 @@ files:
|
|
55
55
|
- README.md
|
56
56
|
- Rakefile
|
57
57
|
- bin/console
|
58
|
-
- bin/diagtool.rb
|
59
58
|
- bin/setup
|
60
59
|
- bin/word_list_sample
|
61
60
|
- exe/diagtool
|
data/bin/diagtool.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Fluentd
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
#!/usr/bin/ruby
|
18
|
-
require 'optparse'
|
19
|
-
require '../lib/collectutils'
|
20
|
-
require '../lib/maskutils'
|
21
|
-
require '../lib/validutils'
|
22
|
-
require '../lib/diagutils'
|
23
|
-
include Diagtool
|
24
|
-
|
25
|
-
params = {}
|
26
|
-
OptionParser.new do |opt|
|
27
|
-
opt.banner = "Usage: #{$0} -o OUTPUT_DIR -m {yes | no} -w {word1,[word2...]} -f {listfile} -s {hash seed}"
|
28
|
-
opt.on('-o','--output DIR', String, 'Output directory (Mandatory)')
|
29
|
-
opt.on('-m','--mask yes|no', String, 'Enable mask function (Optional : Default=no)')
|
30
|
-
opt.on('-w','--word-list word1,word2', Array, 'Provide a list of user-defined words which will to be masked (Optional : Default=None)')
|
31
|
-
opt.on('-f','--word-file listfile', String, 'provide a file which describes a List of user-defined words (Optional : Default=None)')
|
32
|
-
opt.on('-s','--hash-seed seed', String, 'provide a word which will be used when generate the mask (Optional : Default=None)')
|
33
|
-
end.parse!(into: params)
|
34
|
-
diag = DiagUtils.new(params)
|
35
|
-
diag.diagtool()
|
36
|
-
|
37
|
-
|