fluent-diagtool 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c852c088190fa51d4232c45aa7afd4013473c8089e194511a0910a8ca4794e5
4
- data.tar.gz: 96b031de365ad1d47c71b7ffe25dfbd53f4909fe07be484944f7814cfead4939
3
+ metadata.gz: 44527fe77df5bcf3b4888b5a697f796460a69e3873561c88b278e318f5c83cd8
4
+ data.tar.gz: 6052777c8a6930f4dde4bc1fa40bd3a62eba4541253488d419f21f02ab11568a
5
5
  SHA512:
6
- metadata.gz: c6c96dd92c4c8db2975c84395288817b5053b3cdb4b0897970a5e253fc2714886baf0799dd5bd4161439e043c4827a65c178adefde241e2e974de53265bebef8
7
- data.tar.gz: e7d24f7ca1d450e70bc037c74bf1ff8a88e2d174cc77c04211ba164bf7e7e97961b0d2970c8e3e00e0ab57f357c6c13aa8640afc1ffa8b9d7b63d5867630c9e4
6
+ metadata.gz: 1d03c3277e64b402db14aaa6f530c02ceb640ff57b53e170fc2633e63d23a53b4b8f604a292b4a958e74035ccb6dac4f02b782ee58e1ea579e916cf3ba050012
7
+ data.tar.gz: b2d8da326cab4181b391758e9e7fa7cfb8682580726b0921afcc08a6fc8788db818bd325c8a24dcc8ee83975d69d058f306bc8d852b8417a2a4d9f3341e38fd0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-diagtool (1.0.0)
4
+ fluent-diagtool (1.0.1)
5
5
  fileutils
6
6
  json
7
7
 
data/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # Fluentd Diagnostic Tool
2
2
 
3
- The diagtool enables users to automate the date collection which is required for troubleshooting. The data collected by diagtool include the configuration and log files of the td-agent and diagnostic information from an operating system such as network and memory status and stats. In some cases, configuration and log files contain security sensitive information, such as IP addresses and Hostname. The diagtool also provides the functions to generate masks on IP addresses, Hostname(in FQDN style) and user defined keywords described in the collected data.
3
+ Diagtool enables users to automate the date collection which is required for troubleshooting. Diagtool gathers configuration and log files of Fluentd and diagnostic information from an operating system, such as process information and network status. In some cases, configuration and log files contain security sensitive information, such as IP addresses and Hostname. Diagtool has the functions to generate masks on IP addresses, Hostname(in FQDN style) and user defined keywords in the collected files.
4
+
4
5
  The scope of data collection:
5
- - TD Agent information
6
- - configuration files (*)
7
- - log files (*)
6
+ - Fluentd information
7
+ - configuration files
8
+ - log files
8
9
  - td-agent environment values
9
10
  - installed td-agent-gem list
10
11
  - OS information
@@ -20,27 +21,27 @@ The scope of data collection:
20
21
  <br>
21
22
 
22
23
  ## Prerequisite
23
- The diagtool provides support for td-agent based installation running on Linux OS. The td-agent is a stable distribution package of Fluentd.
24
- The differences between Fluentd and td-agent are described in followed url:
25
- https://www.fluentd.org/faqs
24
+ Diagtool has been developed for Fluentd(td-agent) and FluentBit(td-agent-bit) running on Linux OS and Diatool does not work for Windows.
25
+ Diagtool is written in Ruby and Ruby version should be higher than 2.3 for the installation.
26
+ The supported Linux OS is described in the following page:
27
+ https://docs.fluentd.org/quickstart/td-agent-v2-vs-v3-vs-v4
26
28
 
27
29
  ## Diagtool Installation
28
30
 
31
+ When you are using td-agent, you can install Diagtool easily with "/usr/sbin/td-agent-gem" command.
29
32
  ```
30
- # gem install fluent-diagtool
31
- Fetching: fileutils-1.0.2.gem (100%)
32
- Successfully installed fileutils-1.0.2
33
- Fetching: json-2.1.0.gem (100%)
34
- Building native extensions. This could take a while...
35
- Successfully installed json-2.1.0
36
- Fetching: fluent-diagtool-1.0.0.gem (100%)
33
+ # /usr/sbin/td-agent-gem install fluent-diagtool
37
34
  Successfully installed fluent-diagtool-1.0.0
38
- 3 gems installed
35
+ Parsing documentation for fluent-diagtool-1.0.0
36
+ Installing ri documentation for fluent-diagtool-1.0.0
37
+ Done installing documentation for fluent-diagtool after 0 seconds
38
+ 1 gem installed
39
39
  ```
40
- When you are using td-agent, fluent-adiagtool should be installed using /usr/sbin/td-agent-gem command instead of gem command.
40
+ When using /usr/sbin/td-agent-gem command, fluent-diagtool is installed under "/opt/td-agent/embedded/lib/ruby/gems/2.4.0/bin/" directory. You can add that directory to $PATH in .bash_profile.
41
+
42
+ Otherwise, you can install Diagtool with common gem command. In this case, Ruby version higher than 2.3 might be required to install.
41
43
  ```
42
- # /usr/sbin/td-agent-gem install fluent-diagtool
43
- Fetching fluent-diagtool-1.0.0.gem
44
+ # gem install fluent-diagtool
44
45
  Successfully installed fluent-diagtool-1.0.0
45
46
  Parsing documentation for fluent-diagtool-1.0.0
46
47
  Installing ri documentation for fluent-diagtool-1.0.0
@@ -48,11 +49,11 @@ Done installing documentation for fluent-diagtool after 0 seconds
48
49
  1 gem installed
49
50
  ```
50
51
 
52
+
51
53
  ## Usage
52
- There are a few options in Diagtool. You can check the options of Diagtool with "--help" options. Diagtool performs the validation function in the process by default but you can turn on/off the mask function depending on the use cases.
53
54
  ```
54
- # diagtool --help
55
- Usage: /usr/local/bin/diagtool -o OUTPUT_DIR -m {yes | no} -w {word1,[word2...]} -f {listfile} -s {hash seed}
55
+ # fluent-diagtool --help
56
+ Usage: fluent-diagtool -o OUTPUT_DIR -m {yes | no} -w {word1,[word2...]} -f {listfile} -s {hash seed}
56
57
  --precheck Run Precheck (Optional)
57
58
  -t, --type fluentd|fluentbit Select the type of Fluentd (Mandatory)
58
59
  -o, --output DIR Output directory (Mandatory)
@@ -63,26 +64,27 @@ Usage: /usr/local/bin/diagtool -o OUTPUT_DIR -m {yes | no} -w {word1,[word2...]}
63
64
  -c, --conf config_file provide a full path of td-agent configuration file (Optional : Default=None)
64
65
  -l, --log log_file provide a full path of td-agent log file (Optional : Default=None)
65
66
  ```
66
- ### Pre-check
67
- The diagtool automatically parses the path of Fluentd configuration and log files from running Fluentd processes and daemon. The precheck options provides the function to confirm if the diagtool could gather the fluentd information as expected.
68
- The following command output shows the case when the diagtool successfully gather information from daemon.
69
- You need to specify the type of Fluentd, "fluentd" or "fluentbit".
70
- ```
71
- # diagtool --precheck -t fluentd
72
- 2020-05-28 00:39:02 -0400: [Diagtool] [INFO] [Precheck] Check OS parameters...
73
- 2020-05-28 00:39:02 -0400: [Diagtool] [INFO] [Precheck] operating system = CentOS Linux 8 (Core)
74
- 2020-05-28 00:39:02 -0400: [Diagtool] [INFO] [Precheck] kernel version = Linux 4.18.0-147.el8.x86_64
75
- 2020-05-28 00:39:02 -0400: [Diagtool] [INFO] [Precheck] Check td-agent parameters...
76
- 2020-05-28 00:39:02 -0400: [Diagtool] [INFO] [Precheck] td-agent conf path = /etc/td-agent/
77
- 2020-05-28 00:39:02 -0400: [Diagtool] [INFO] [Precheck] td-agent conf file = td-agent.conf
78
- 2020-05-28 00:39:02 -0400: [Diagtool] [INFO] [Precheck] td-agent log path = /var/log/td-agent/
79
- 2020-05-28 00:39:02 -0400: [Diagtool] [INFO] [Precheck] td-agent log = td-agent.log
80
- 2020-05-28 00:39:02 -0400: [Diagtool] [INFO] [Precheck] Precheck completed. You can run diagtool command without -c and -l options
81
- ```
82
- In some cases, users do not manage td-agent as daemon but use their own scripts to run td-agent with command line options. In that cases, users need to specify the path of td-agent configuration and log files with -c and -l options respectively.
83
- The following example shows the precheck results when the diagtool is not able to extract the path of td-agent configuration and log files.
84
- ```
85
- # diagtool --precheck -t fluentd
67
+ ### Precheck
68
+ In order to run Diagtool correctly, it is required to ensure that Diagtool can obtain the fundamental information of Fluentd. Basically, Diagtool automatically parses the required information from the running Fluentd processes. The precheck option is useful to confirm if Diagtool certainly collects the information as expected.
69
+ The following output example shows the case where Diatool properly collects the required information.
70
+
71
+ ```
72
+ # fluent-diagtool --precheck -t fluentd
73
+ 2020-10-07 21:20:33 +0000: [Diagtool] [INFO] [Precheck] Fluentd Type = fluentd
74
+ 2020-10-07 21:20:33 +0000: [Diagtool] [INFO] [Precheck] Check OS parameters...
75
+ 2020-10-07 21:20:33 +0000: [Diagtool] [INFO] [Precheck] operating system = CentOS Linux 7 (Core)
76
+ 2020-10-07 21:20:33 +0000: [Diagtool] [INFO] [Precheck] kernel version = Linux 3.10.0-1127.10.1.el7.x86_64
77
+ 2020-10-07 21:20:33 +0000: [Diagtool] [INFO] [Precheck] Check td-agent parameters...
78
+ 2020-10-07 21:20:33 +0000: [Diagtool] [INFO] [Precheck] td-agent conf path = /etc/td-agent/
79
+ 2020-10-07 21:20:33 +0000: [Diagtool] [INFO] [Precheck] td-agent conf file = td-agent.conf
80
+ 2020-10-07 21:20:33 +0000: [Diagtool] [INFO] [Precheck] td-agent log path = /var/log/td-agent/
81
+ 2020-10-07 21:20:33 +0000: [Diagtool] [INFO] [Precheck] td-agent log = td-agent.log
82
+ 2020-10-07 21:20:33 +0000: [Diagtool] [INFO] [Precheck] Precheck completed. You can run diagtool command without -c and -l options
83
+ ```
84
+ In some cases, Dialtool, with custom command line options, may fail to identify the path of Fluentd configuration and log files. You need to specify this information manually with “-c” and “-l” options.
85
+ The following example shows pre-check returns failure resulting Diagtool is not able to extract the path of td-agent configuration and log files.
86
+ ```
87
+ # fluent-diagtool --precheck -t fluentd
86
88
  2020-05-28 05:45:14 +0000: [Diagtool] [INFO] [Precheck] Check OS parameters...
87
89
  2020-05-28 05:45:14 +0000: [Diagtool] [INFO] [Precheck] operating system = CentOS Linux 8 (Core)
88
90
  2020-05-28 05:45:14 +0000: [Diagtool] [INFO] [Precheck] kernel version = Linux 4.18.0-147.5.1.el8_1.x86_64
@@ -96,9 +98,72 @@ The following example shows the precheck results when the diagtool is not able t
96
98
  ```
97
99
 
98
100
  ### Run diagtool
101
+ Once the pre-check is completed, you are ready to run the tool. The “-o” is mandatory out of provided options and the output will be generated as a compressed file under the directory specified by “-o“ option.
102
+ (*) If the pre-check results mentioned that it is not able to find “td-agent conf path” and “td-agent log path“, you need to use “-c“ and “-l” respectively to specify the file path manually.
103
+
104
+ #### Command sample:
105
+ ```
106
+ # fluent-diagtool -t fluentd -o /tmp -w passwd1,passwd2 -m yes
107
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] Parsing command options...
108
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] Option : Output directory = /tmp
109
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] Option : Mask = yes
110
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] Option : Word list = ["passwd1", "passwd2"]
111
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] Option : Hash Seed =
112
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] Initializing parameters...
113
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] Loading the environment parameters...
114
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] operating system = CentOS Linux 7 (Core)
115
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] kernel version = Linux 3.10.0-1127.10.1.el7.x86_64
116
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] td-agent conf path = /etc/td-agent/
117
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] td-agent conf file = td-agent.conf
118
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] td-agent log path = /var/log/td-agent/
119
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] td-agent log = td-agent.log
120
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] Collecting log files of td-agent...
121
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] Collecting config file of td-agent...
122
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] config file is stored in ["/tmp/20201007212928/etc/td-agent/td-agent.conf", "/tmp/20201007212928/etc/td-agent/http_fld_system.conf"]
123
+ 2020-10-07 21:29:28 +0000: [Diagtool] [INFO] [Collect] Collecting td-agent gem information...
124
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Collect] td-agent gem information is stored in /tmp/20201007212928/output/tdgem_list.output
125
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Collect] Collecting config file of OS log...
126
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Mask] Masking OS log file : /tmp/20201007212928/var/log/messages...
127
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Collect] config file is stored in /tmp/20201007212928/var/log/messages.mask
128
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Collect] Collecting date/time information...
129
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Collect] date/time information is stored in /tmp/20201007212928/output/chronyc_sources.txt
130
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Collect] Collecting command output : command = ps -eo pid,ppid,stime,time,%mem,%cpu,cmd
131
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Mask] Masking command output file : /tmp/20201007212928/output/ps_-eo_pid_ppid_stime_time_%mem_%cpu_cmd.txt...
132
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Collect] Collecting command output ps stored in /tmp/20201007212928/output/ps_-eo_pid_ppid_stime_time_%mem_%cpu_cmd.txt.mask
133
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Collect] Collecting command output : command = cat /proc/meminfo
134
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Mask] Masking command output file : /tmp/20201007212928/output/cat_-proc-meminfo.txt...
135
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Collect] Collecting command output cat stored in /tmp/20201007212928/output/cat_-proc-meminfo.txt.mask
136
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Collect] Collecting command output : command = netstat -plan
137
+ 2020-10-07 21:29:29 +0000: [Diagtool] [INFO] [Mask] Masking command output file : /tmp/20201007212928/output/netstat_-plan.txt...
138
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Collect] Collecting command output netstat stored in /tmp/20201007212928/output/netstat_-plan.txt.mask
139
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Collect] Collecting command output : command = netstat -s
140
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Mask] Masking command output file : /tmp/20201007212928/output/netstat_-s.txt...
141
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Collect] Collecting command output netstat stored in /tmp/20201007212928/output/netstat_-s.txt.mask
142
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Collect] Collecting systctl information...
143
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Collect] sysctl information is stored in /tmp/20201007212928/output/sysctl_-a.txt
144
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Validating systctl information...
145
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Sysctl: net_core_netdev_max_backlog => 5000 is correct (recommendation is 5000)
146
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Sysctl: net_core_rmem_max => 16777216 is correct (recommendation is 16777216)
147
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Sysctl: net_core_somaxconn => 1024 is correct (recommendation is 1024)
148
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Sysctl: net_core_wmem_max => 16777216 is correct (recommendation is 16777216)
149
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_ip_local_port_range => ["10240", "65535"] is correct (recommendation is ["10240", "65535"])
150
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_tcp_max_syn_backlog => 8096 is correct (recommendation is 8096)
151
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_tcp_rmem => ["4096", "12582912", "16777216"] is correct (recommendation is ["4096", "12582912", "16777216"])
152
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_tcp_slow_start_after_idle => 0 is correct (recommendation is 0)
153
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_tcp_tw_reuse => 1 is correct (recommendation is 1)
154
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_tcp_wmem => ["4096", "12582912", "16777216"] is correct (recommendation is ["4096", "12582912", "16777216"])
155
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Collect] Collecting ulimit information...
156
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Collect] ulimit information is stored in /tmp/20201007212928/output/sh_-c_'ulimit_-n'.txt
157
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] Validating ulimit information...
158
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Valid] ulimit => 65536 is correct (recommendation is >65535)
159
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Mask] Masking td-agent config file : /tmp/20201007212928/etc/td-agent/td-agent.conf...
160
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Mask] Masking td-agent config file : /tmp/20201007212928/etc/td-agent/http_fld_system.conf...
161
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Mask] Export mask log file : ./mask_20201007212928.json
162
+ 2020-10-07 21:29:30 +0000: [Diagtool] [INFO] [Collect] Generate tar file /tmp/diagout-20201007212928.tar.gz
163
+ ```
99
164
 
100
165
  #### The "@include" directive in td-agent configuration file
101
- The "@include" directive is a function to reuse configuration defined in other configuration files. The diagtool reads the td-agent configuration and collects the files described in "@include" directive as well. The details of "@include" directive are described in followed url:
166
+ The "@include" directive is a function to reuse configuration defined in other configuration files. Diagtool reads Fluentd configuration and gathers the files described in "@include" directive as well. The details of "@include" directive are described in followed page:
102
167
  https://docs.fluentd.org/configuration/config-file#6-re-use-your-config-the-include-directive
103
168
 
104
169
  #### User defined words to be masked
@@ -111,66 +176,8 @@ centos8102
111
176
  ```
112
177
  NOTE: When user specified the keywork, only the exact match words will be masked. For instance, when users like to mask words like "nginx1" and "nginx2", users need to specify "nginx1" and "nginx2" respectively and "nginx*" should not work in the tool.
113
178
 
114
- #### Command sample:
115
- ```
116
- # diagtool -t fluentd -o /tmp/work1 -w passwd1,passwd2 -f word_list_sample -m yes
117
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] Parsing command options...
118
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] Option : Output directory = /tmp/work1
119
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] Option : Mask = yes
120
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] Option : Word list = ["passwd1", "passwd2", "centos8101", "centos8102"]
121
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] Option : Hash Seed =
122
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] Initializing parameters...
123
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] Loading the environment parameters...
124
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] operating system = CentOS Linux 8 (Core)
125
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] kernel version = Linux 4.18.0-147.el8.x86_64
126
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] td-agent conf path = /etc/td-agent/
127
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] td-agent conf file = td-agent.conf
128
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] td-agent log path = /var/log/td-agent/
129
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] td-agent log = td-agent.log
130
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] Collecting log files of td-agent...
131
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] log files of td-agent are stored in ["/tmp/work1/20200512182119/var/log/td-agent/td-agent.log-20200508.gz", "/tmp/work1/20200512182119/var/log/td-agent/td-agent.log-20200509.gz", "/tmp/work1/20200512182119/var/log/td-agent/td-agent.log-20200507.gz", "/tmp/work1/20200512182119/var/log/td-agent/td-agent.log-20200512", "/tmp/work1/20200512182119/var/log/td-agent/td-agent.log"]
132
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] Collecting config file of td-agent...
133
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] config file is stored in /tmp/work1/20200512182119/etc/td-agent/td-agent.conf
134
- 2020-05-12 18:21:19 -0400: [Diagtool] [INFO] [Collect] Collecting td-agent gem information...
135
- 2020-05-12 18:21:20 -0400: [Diagtool] [INFO] [Collect] td-agent gem information is stored in /tmp/work1/20200512182119/etc/td-agent/tdgem_list.output
136
- 2020-05-12 18:21:20 -0400: [Diagtool] [INFO] [Collect] Collecting config file of OS log...
137
- 2020-05-12 18:21:20 -0400: [Diagtool] [INFO] [Mask] Masking OS log file : /tmp/work1/20200512182119/var/log/messages...
138
- 2020-05-12 18:21:20 -0400: [Diagtool] [INFO] [Collect] config file is stored in /tmp/work1/20200512182119/var/log/messages.mask
139
- 2020-05-12 18:21:20 -0400: [Diagtool] [INFO] [Collect] Collecting OS memory information...
140
- 2020-05-12 18:21:20 -0400: [Diagtool] [INFO] [Collect] config file is stored in /tmp/work1/20200512182119/meminfo.output
141
- 2020-05-12 18:21:20 -0400: [Diagtool] [INFO] [Collect] Collecting date/time information...
142
- 2020-05-12 18:21:20 -0400: [Diagtool] [INFO] [Collect] date/time information is stored in /tmp/work1/20200512182119/ntp_info.output
143
- 2020-05-12 18:21:20 -0400: [Diagtool] [INFO] [Collect] Collecting netstat information...
144
- 2020-05-12 18:21:20 -0400: [Diagtool] [INFO] [Mask] Masking netstat file : /tmp/work1/20200512182119/netstat_n.output...
145
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Collect] netstat information is stored in /tmp/work1/20200512182119/netstat_n.output.mask and /tmp/work1/20200512182119/netstat_s.output
146
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Collect] Collecting systctl information...
147
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Collect] sysctl information is stored in /tmp/work1/20200512182119/etc/sysctl.conf
148
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Validating systctl information...
149
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Sysctl: net_core_somaxconn => 1024 is correct (recommendation is 1024)
150
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Sysctl: net_core_netdev_max_backlog => 5000 is correct (recommendation is 5000)
151
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Sysctl: net_core_rmem_max => 16777216 is correct (recommendation is 16777216)
152
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Sysctl: net_core_wmem_max => 16777216 is correct (recommendation is 16777216)
153
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_tcp_wmem => ["4096", "12582912", "16777216"] is correct (recommendation is ["4096", "12582912", "16777216"])
154
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_tcp_rmem => ["4096", "12582912", "16777216"] is correct (recommendation is ["4096", "12582912", "16777216"])
155
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_tcp_max_syn_backlog => 8096 is correct (recommendation is 8096)
156
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_tcp_slow_start_after_idle => 0 is correct (recommendation is 0)
157
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_tcp_tw_reuse => 1 is correct (recommendation is 1)
158
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Sysctl: net_ipv4_ip_local_port_range => ["10240", "65535"] is correct (recommendation is ["10240", "65535"])
159
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Collect] Collecting ulimit information...
160
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Collect] ulimit information is stored in /tmp/work1/20200512182119/ulimit_n.output
161
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] Validating ulimit information...
162
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Valid] ulimit => 65536 is correct (recommendation is >65535)
163
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Mask] Masking td-agent config file : /tmp/work1/20200512182119/etc/td-agent/td-agent.conf...
164
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Mask] Masking td-agent log file : /tmp/work1/20200512182119/var/log/td-agent/td-agent.log-20200508.gz...
165
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Mask] Masking td-agent log file : /tmp/work1/20200512182119/var/log/td-agent/td-agent.log-20200509.gz...
166
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Mask] Masking td-agent log file : /tmp/work1/20200512182119/var/log/td-agent/td-agent.log-20200507.gz...
167
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Mask] Masking td-agent log file : /tmp/work1/20200512182119/var/log/td-agent/td-agent.log-20200512...
168
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Mask] Masking td-agent log file : /tmp/work1/20200512182119/var/log/td-agent/td-agent.log...
169
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Mask] Export mask log file : ./mask_20200512182119.json
170
- 2020-05-12 18:21:22 -0400: [Diagtool] [INFO] [Collect] Generate tar file /tmp/work1/diagout-20200512182119.tar.gz
171
- ```
172
179
  #### Mask Function
173
- When run diagtool with the mask option, the log of mask is also created in 'mask_{timestamp}.json' file. Users are able to confirm how the mask was generated on each file.
180
+ When run Diagtool with the mask option, the log of mask is also created in 'mask_{timestamp}.json' file. Users are able to confirm how the mask was generated on each file.
174
181
  The diagtool provides a hash-seed option with '-s'. When hash-seed is specified, the mask will be generated with the original word and hash-seed so that users could use a unique mask value.
175
182
  #### Mask sample - IP address: IPv4_{md5hash}
176
183
  ```
@@ -196,8 +203,6 @@ The diagtool provides a hash-seed option with '-s'. When hash-seed is specified,
196
203
  ```
197
204
 
198
205
  ## Tested Environment
199
- - OS : CentOS 8.1
200
- - Fluentd : td-agent version 3/4
206
+ - OS : CentOS 8.1 / Ubuntu 20.04
207
+ - Fluentd : td-agent version 3/4
201
208
  https://docs.fluentd.org/quickstart/td-agent-v2-vs-v3
202
- - Fluentbit : td-agent-bit
203
-
@@ -36,7 +36,9 @@ module Diagtool
36
36
  'FLUENT_CONF' => '',
37
37
  'TD_AGENT_LOG_FILE' => ''
38
38
  }
39
-
39
+ @package_name = conf[:package_name]
40
+ @service_name = conf[:service_name]
41
+
40
42
  case @type
41
43
  when 'fluentd'
42
44
  _find_fluentd_info()
@@ -52,7 +54,7 @@ module Diagtool
52
54
  @tdconf = @tdenv['FLUENT_CONF'].split('/')[-1]
53
55
  @tdconf_path = @tdenv['FLUENT_CONF'].gsub(@tdconf,'')
54
56
  else
55
- raise "The path of td-agent configuration file need to be specified." if conf[:precheck] == false
57
+ raise "The path of #{@package_name} configuration file need to be specified." if conf[:precheck] == false
56
58
  end
57
59
  end
58
60
  if not conf[:tdlog].empty?
@@ -62,10 +64,13 @@ module Diagtool
62
64
  if not @tdenv['TD_AGENT_LOG_FILE'].empty?
63
65
  @tdlog = @tdenv['TD_AGENT_LOG_FILE'].split('/')[-1]
64
66
  @tdlog_path = @tdenv['TD_AGENT_LOG_FILE'].gsub(@tdlog,'')
67
+ elsif not @tdenv['FLUENT_PACKAGE_LOG_FILE'].empty?
68
+ @tdlog = @tdenv['FLUENT_PACKAGE_LOG_FILE'].split('/')[-1]
69
+ @tdlog_path = @tdenv['FLUENT_PACKAGE_LOG_FILE'].gsub(@tdlog,'')
65
70
  else
66
71
  case @type
67
72
  when 'fluentd'
68
- raise "The path of td-agent log file need to be specified." if conf[:precheck] == false
73
+ raise "The path of #{@package_name} log file need to be specified." if conf[:precheck] == false
69
74
  when 'fluentbit'
70
75
  @logger.warn("FluentBit logs are redirected to the standard output interface ")
71
76
  end
@@ -81,10 +86,10 @@ module Diagtool
81
86
  @logger.info("Loading the environment parameters...")
82
87
  @logger.info(" operating system = #{@osenv['Operating System']}")
83
88
  @logger.info(" kernel version = #{@osenv['Kernel']}")
84
- @logger.info(" td-agent conf path = #{@tdconf_path}")
85
- @logger.info(" td-agent conf file = #{@tdconf}")
86
- @logger.info(" td-agent log path = #{@tdlog_path}")
87
- @logger.info(" td-agent log = #{@tdlog}")
89
+ @logger.info(" #{@package_name} conf path = #{@tdconf_path}")
90
+ @logger.info(" #{@package_name} conf file = #{@tdconf}")
91
+ @logger.info(" #{@package_name} log path = #{@tdlog_path}")
92
+ @logger.info(" #{@package_name} log = #{@tdlog}")
88
93
  end
89
94
 
90
95
  def _find_os_info()
@@ -104,7 +109,7 @@ module Diagtool
104
109
 
105
110
  def _find_fluentd_info()
106
111
  ### check if the td-agent is run as daemon
107
- stdout, stderr, status = Open3.capture3('systemctl cat td-agent')
112
+ stdout, stderr, status = Open3.capture3("systemctl cat #{@service_name}")
108
113
  if status.success?
109
114
  if @precheck == false # SKip if precheck is true
110
115
  File.open(@outdir+'/td-agent_env.output', 'w') do |f|
@@ -240,7 +245,7 @@ module Diagtool
240
245
  end
241
246
  inc_list.push inc_http
242
247
  else
243
- if l.start_with?(/\//) # /tmp/work1/b.conf
248
+ if l.start_with?('/') # /tmp/work1/b.conf
244
249
  if l.include?('*')
245
250
  Dir.glob(l).each { |ll|
246
251
  inc_conf = target_dir + ll.gsub(/\//,'-')
@@ -365,7 +370,7 @@ module Diagtool
365
370
  FileUtils.cp(@oslog_path+@syslog, target_dir)
366
371
  return target_dir+@syslog
367
372
  else
368
- @logger.warn("Can not find OS log file in #{oslog} or #{syslog}")
373
+ @logger.warn("Can not find OS log file in #{@oslog} or #{@syslog}")
369
374
  end
370
375
  end
371
376
 
@@ -400,7 +405,12 @@ module Diagtool
400
405
 
401
406
  def collect_tdgems()
402
407
  output = @outdir+'/tdgem_list.output'
403
- stdout, stderr, status = Open3.capture3("td-agent-gem list | grep fluent")
408
+ command = if @package_name == "fluent-package"
409
+ "fluent-gem"
410
+ else
411
+ "td-agent-gem"
412
+ end
413
+ stdout, stderr, status = Open3.capture3("#{command} list | grep fluent")
404
414
  File.open(output, 'w') do |f|
405
415
  f.puts(stdout)
406
416
  end
@@ -33,6 +33,13 @@ module Diagtool
33
33
  "netstat -plan",
34
34
  "netstat -s",
35
35
  ]
36
+ if fluent_package?
37
+ @conf[:package_name] = "fluent-package"
38
+ @conf[:service_name] = "fluentd"
39
+ else
40
+ @conf[:package_name] = "td-agent"
41
+ @conf[:service_name] = "td-agent"
42
+ end
36
43
  end
37
44
 
38
45
  def run_precheck()
@@ -46,16 +53,16 @@ module Diagtool
46
53
  prechecklog.info("[Precheck] Check OS parameters...")
47
54
  prechecklog.info("[Precheck] operating system = #{c_env[:os]}")
48
55
  prechecklog.info("[Precheck] kernel version = #{c_env[:kernel]}")
49
- prechecklog.info("[Precheck] Check td-agent parameters...")
50
- prechecklog.info("[Precheck] td-agent conf path = #{c_env[:tdconf_path]}")
51
- prechecklog.info("[Precheck] td-agent conf file = #{c_env[:tdconf]}")
52
- prechecklog.info("[Precheck] td-agent log path = #{c_env[:tdlog_path]}")
53
- prechecklog.info("[Precheck] td-agent log = #{c_env[:tdlog]}")
56
+ prechecklog.info("[Precheck] Check #{@conf[:package_name]} parameters...")
57
+ prechecklog.info("[Precheck] #{@conf[:package_name]} conf path = #{c_env[:tdconf_path]}")
58
+ prechecklog.info("[Precheck] #{@conf[:package_name]} conf file = #{c_env[:tdconf]}")
59
+ prechecklog.info("[Precheck] #{@conf[:package_name]} log path = #{c_env[:tdlog_path]}")
60
+ prechecklog.info("[Precheck] #{@conf[:package_name]} log = #{c_env[:tdlog]}")
54
61
  if c_env[:tdconf_path] == nil || c_env[:tdconf] == nil
55
- prechecklog.warn("[Precheck] can not find td-agent conf path: please run diagtool command with -c /path/to/<td-agent conf file>")
62
+ prechecklog.warn("[Precheck] can not find #{@conf[:package_name]} conf path: please run diagtool command with -c /path/to/<#{@conf[:package_name]} conf file>")
56
63
  end
57
64
  if c_env[:tdlog_path] == nil || c_env[:tdlog] == nil
58
- prechecklog.warn("[Precheck] can not find td-agent log path: please run diagtool command with -l /path/to/<td-agent log file>")
65
+ prechecklog.warn("[Precheck] can not find #{@conf[:package_name]} log path: please run diagtool command with -l /path/to/<#{@conf[:package_name]} log file>")
59
66
  end
60
67
  if c_env[:tdconf_path] != nil && c_env[:tdconf] != nil && c_env[:tdlog_path] != nil && c_env[:tdlog] != nil
61
68
  prechecklog.info("[Precheck] Precheck completed. You can run diagtool command without -c and -l options")
@@ -90,35 +97,35 @@ module Diagtool
90
97
  diaglogger_info("[Collect] Loading the environment parameters...")
91
98
  diaglogger_info("[Collect] operating system = #{c_env[:os]}")
92
99
  diaglogger_info("[Collect] kernel version = #{c_env[:kernel]}")
93
- diaglogger_info("[Collect] td-agent conf path = #{c_env[:tdconf_path]}")
94
- diaglogger_info("[Collect] td-agent conf file = #{c_env[:tdconf]}")
95
- diaglogger_info("[Collect] td-agent log path = #{c_env[:tdlog_path]}")
96
- diaglogger_info("[Collect] td-agent log = #{c_env[:tdlog]}")
100
+ diaglogger_info("[Collect] #{@conf[:package_name]} conf path = #{c_env[:tdconf_path]}")
101
+ diaglogger_info("[Collect] #{@conf[:package_name]} conf file = #{c_env[:tdconf]}")
102
+ diaglogger_info("[Collect] #{@conf[:package_name]} log path = #{c_env[:tdlog_path]}")
103
+ diaglogger_info("[Collect] #{@conf[:package_name]} log = #{c_env[:tdlog]}")
97
104
  m = MaskUtils.new(@conf, loglevel)
98
105
  v = ValidUtils.new(loglevel)
99
106
 
100
- diaglogger_info("[Collect] Collecting log files of td-agent...")
107
+ diaglogger_info("[Collect] Collecting log files of #{@conf[:package_name]}...")
101
108
  case @type
102
109
  when 'fluentd'
103
110
  tdlog = c.collect_tdlog()
104
- diaglogger_info("[Collect] log files of td-agent are stored in #{tdlog}")
111
+ diaglogger_info("[Collect] log files of #{@conf[:package_name]} are stored in #{tdlog}")
105
112
  when 'fleuntbit'
106
113
  if tdlog.empty?
107
114
  diaglogger_info("FluentBit logs are redirected to the standard output interface ")
108
115
  tdlog = ''
109
116
  else
110
117
  tdlog = c.collect_tdlog()
111
- diaglogger_info("[Collect] log files of td-agent are stored in #{tdlog}")
118
+ diaglogger_info("[Collect] log files of #{@conf[:package_name]} are stored in #{tdlog}")
112
119
  end
113
120
  end
114
121
 
115
- diaglogger_info("[Collect] Collecting config file of td-agent...")
122
+ diaglogger_info("[Collect] Collecting config file of #{@conf[:package_name]}...")
116
123
  tdconf = c.collect_tdconf()
117
124
  diaglogger_info("[Collect] config file is stored in #{tdconf}")
118
125
 
119
- diaglogger_info("[Collect] Collecting td-agent gem information...")
126
+ diaglogger_info("[Collect] Collecting #{@conf[:package_name]} gem information...")
120
127
  tdgem = c.collect_tdgems()
121
- diaglogger_info("[Collect] td-agent gem information is stored in #{tdgem}")
128
+ diaglogger_info("[Collect] #{@conf[:package_name]} gem information is stored in #{tdgem}")
122
129
 
123
130
  diaglogger_info("[Collect] Collecting config file of OS log...")
124
131
  oslog = c.collect_oslog()
@@ -157,11 +164,11 @@ module Diagtool
157
164
  ###
158
165
  # Correct information to be validated
159
166
  ###
160
- diaglogger_info("[Collect] Collecting systctl information...")
167
+ diaglogger_info("[Collect] Collecting sysctl information...")
161
168
  sysctl = c.collect_cmd_output("sysctl -a")
162
169
  diaglogger_info("[Collect] sysctl information is stored in #{sysctl}")
163
170
 
164
- diaglogger_info("[Valid] Validating systctl information...")
171
+ diaglogger_info("[Valid] Validating sysctl information...")
165
172
  ret, sysctl = v.valid_sysctl(sysctl)
166
173
  list = sysctl.keys
167
174
  list.each do |k|
@@ -186,7 +193,7 @@ module Diagtool
186
193
 
187
194
  if @conf[:mask] == 'yes'
188
195
  tdconf.each { | file |
189
- diaglogger_info("[Mask] Masking td-agent config file : #{file}...")
196
+ diaglogger_info("[Mask] Masking #{@conf[:package_name]} config file : #{file}...")
190
197
  m.mask_tdlog(file, clean = true)
191
198
  }
192
199
  end
@@ -194,7 +201,7 @@ module Diagtool
194
201
  if @conf[:mask] == 'yes'
195
202
  if tdlog != nil
196
203
  tdlog.each { | file |
197
- diaglogger_info("[Mask] Masking td-agent log file : #{file}...")
204
+ diaglogger_info("[Mask] Masking #{@conf[:package_name]} log file : #{file}...")
198
205
  filename = file.split("/")[-1]
199
206
  if filename.include?(".gz")
200
207
  m.mask_tdlog_gz(file, clean = true)
@@ -229,7 +236,7 @@ module Diagtool
229
236
  if Dir.exist?(params[:output])
230
237
  options[:basedir] = params[:output]
231
238
  else
232
- raise "output directory '#{basedir}' does not exist"
239
+ raise "output directory '#{params[:output]}' does not exist"
233
240
  end
234
241
  else
235
242
  raise "output directory '-o' must be specified"
@@ -313,5 +320,9 @@ module Diagtool
313
320
  @logger.error(str)
314
321
  @logger_file.error(str)
315
322
  end
323
+
324
+ def fluent_package?
325
+ File.exist?("/etc/fluent/fluentd.conf") || File.exist?("/opt/fluent/bin/fluentd")
326
+ end
316
327
  end
317
328
  end
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
2
  module Diagtool
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-diagtool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kubotat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-07 00:00:00.000000000 Z
11
+ date: 2023-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fileutils
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubygems_version: 3.1.2
88
+ rubygems_version: 3.4.10
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: Diagnostic Tool for Fluentd