Fluentd Subscription Network

View Original

Diagtool - automated Fluentd troubleshooting.

Introduction of “diagtool”

Diagtool is a simple, yet powerful tool to simplify troubleshooting process and also make it more secure. Diagtool delivers the functions you need to automate your process and accelerate the problem determination :

The code has been contributed in the Fluentd community. You can download instructions for Diagtool here.

Collect function : 

  • Automate the data collection needed to diagnose the symptom of Fluentd and its base instance.

  • Collect not only the Fluentd configuration and log but also information about the OS such as resource usage, processes running in the instance and network connectivity.

Validate function : 

  • Inspect and validate the OS parameters to check if they meet requirements.

Mask function : 

  • Generate masks on sensitive information such as hostname, IP address and your defined key word.

  • This function is optional; you can enable or disable the function using a command option.

How to install diagtool

Installation

Diagtool is a RubyGem and easy to install with the installation tool of td-agent. Please make sure you use the “/usr/bin/td-agent-gem” command instead of the ordinary gem command.

See this content in the original post

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.

Otherwise, you can install Diagtool with common gem command. In this case, Ruby version higher than 2.3 might be required to install.

See this content in the original post

Command options

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.

See this content in the original post

Pre-check

In order to run Diagtool correctly, you must ensure that Diagtool can obtain the fundamental information of Fluentd. Essentially, Diagtool automatically parses the required information from the environment values of td-agent daemon. The pre-check option is useful to confirm if Diagtool has definitely collected the information as expected. 

The following output example shows the case where Diatool properly collects the required information.

See this content in the original post

In some cases, Diagtool, with custom command line options, may fail to identify the path of the Fluentd configuration and log files. In this case, you will need to specify this information manually with the “-c” and “-l” options. 

The following example shows a pre-check returns failure resulting in Diagtool not being able to extract the path of td-agent configuration and log files.

See this content in the original post

Run Diagtool

Once the pre-check is completed, you are ready to run the tool. The “-o” is mandatory out of potential options and the output will be generated as a compressed file under the directory specified by the “-o“ option.

(*) If the pre-check results report that it can’t find “td-agent conf path” and “td-agent log path“, you need to use “-c“ and “-l”  respectively to specify the file path manually.

See this content in the original post

You can find the learn more about how Diagtool works in the following video cast.

Question?

You can always download instruction on how to use the Diagtool here.
Also, feel free to contact us any time by making a request via Github or send any questions and requests for enhancement directly to us. We’d love to hear from you!


Where is the tool heading?

Today we support fluentd (td-agent core) for Linux. We are working to enhance the coverage to Windows OS as well as FluentBit and plugins. We are always welcoming more people to contribute the tool.

Commercial Service - We are here for you.

In the Fluentd Subscription Network, we will provide you consultancy and professional services to help you run Fluentd and Fluent Bit with confidence by solving your pains. Service desk is also available for your operation and the team is equipped with the Diagtool and knowledge of tips running Fluentd in production. Contact us anytime if you would like to learn more about our service offerings.