joppot

The program absolutely runs in copy paste

Setup of td-agent-ui and operation check

      2017/03/25

Pocket


Abstract

Hello everyone, It’s candle.
In this time, I will show you how to set up td-agent-ui and operation check.
Td-agent is easier than fluentd to operate on the server.


Precondition

Td-agent is installed

Please refer to the following article when building td-agent to Centos 6.5.

Build up a td-agent server on centos 6.5

For EC2, here

Build up td-agent server on the EC2 of aws

SPONSORED LINK


Launching of td-agent

td-agent-ui is already installed when you install td-agent.
The launch command of td-agent-ui is this.

sudo td-agent-ui start

You may caught some warning, It’ probably no problem.


Set up td-agent-ui

After starting server, let’s access to td-agent-ui.
You access to own IP address + 9292.

For vagrant, the IP address written in Vagrantfile.
For EC2, let’s access the public IP address.

Account name is “admin”, password is “changeme”.

After login, the setup page will appear.



Chnage the password

First, You would change the password.
If anybody access to your server from anywhere, default password is dangerous.

Click the “Password” fron the left menu.

Enter “changeme” to the current password and set a new password

Set up td-agent

Back to the top page and set up td-agent.

In the top page, there are “Setup fluentd” and “Setup td-agent”.
Both can use the function of fluentd.
I recommend td-agent.
Click “Setup td-agent”.

The page to create configuration file display.
There are already files exists such as “/etc/td-agent/td-agent.conf” before pressing “Create” button.

Click “create” button.
After that, the following page will be displayed.
If logs are not displayed, let’s restart “td-agent”.

It’s over.

Td-agent log setting

Let’s try to set up to collect the log by the td-agent conf file.
There is the td-agent conf file.

/etc/td-agent/td-agent.conf

Of course, you can edit it in CUI,
Let’s edit it from td-agent-ui.

Choose “Config File” from the left menu.

Click the “Edit” button.

Considering security, it is better to delete the settings that are not used.
Delete all contents of the setting file and write the following.

<source>
 @type forward
</source>

<match debug.**>
  type stdout
</match>

Press “Update & Restart” button.

The above setting meaning is like this.directive is which logs will collecte.
In this case it will receive the log from type forward.

In , it means to display on the td-agent standard output what tagged with “debug.anything-string” received in source type forward.


Debugging with fluent-cat

Let’s try to get the tag of debug.**.

The fluent-cat command send data to fluentd (td-agent) with tcp.
The location of the fluent-cat command is in a place where PATH does not through.

/opt/td-agent/embedded/bin/fluent-cat

The following command, you can send data to fluentd.

echo '{"I say":"hello"}' | /opt/td-agent/embedded/bin/fluent-cat debug.ok

The contents of echo are json. You throw it to td-agent with a tag called debug.ok.

Nothing is displayed on the terminal,
Looking at the log on the browser, it certainly arrived.

It is success.

Conclusion

One last thing, even though td-agent-ui is useful, it is dangerous in security.
You should not launch td-agent as much as possible, even if you activate it, restrict access by IP address.

 - サーバ ,