joppot

コピペで絶対動く。説明を妥協しない

サーバ

Setup of td-agent-ui and operation check

投稿日:2017年3月19日 更新日:



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



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.

スポンサードリンク

If you think this article is good, share it please

-サーバ
-,

執筆者:


comment

Your email address will not be published. Required fields are marked *

関連記事

How to get nginx error.log and access.log with td-agent

English 日本語 Abstract Hello everyone, It’s candle. In this time, we collect nginx log with td-agent. I explain with td-agent, but basic configuration is similer with fluentd. Precondition Td-agent or fluentd is installed You have a nginx server.

Build up a td-agent server on centos 6.5

English 日本語 Abstract Hello everyone, It’s candle. In this time, we build up a td-agent server on the centos 6.5. Td-agent is service based on fluentd. It daemonizes fluentd and creates a GUI. Premise You have Centos 6.5 server. I use Centos 6.5 on the vagrant for explanation.

Allocate original domain of Route53 to React hosted at S3

Abstract Hello everyone it’s me candle. We will allocate original domain of Route53 to React hosted in S3. Condition You have a domain at Route53 You have a bucket with the same name as domain in S3 Your React is already hosting on S3 Importantly, the bucket of S3 and the domain name acquired by Route53 must be the same name.If you have not created a bucket yet in S3 or React web app is not hosted in S3, please refer to the previous article. Checking The domain of Route53 I have joppot.info domain at Route53. I will allocate “reacttest.joppot.info” …

Monitor the memory state of ec2 with watch and free command

English 日本語 Abstract Hello everyone, It’s candle. In this time, I will show you how to monitor ec2 memory in real time. EC2 server of t2.micro has only 1GB of memory, If you run composer, rails, mysql on it, memory may be barely. It is useful if you can monitor the memory and tune the server. Precondition EC2 server

Install only mysql command for RDS in EC2

Abstract Hello everyone it’s me candle. This topic is a little thing but I note to self. If we use RDS, we don’t need Mysql server in the EC2. You may want to install only the mysql command. I will explain it. Precondition You use EC2 and RDS


I work in the venture company as a CTO. I start to write program in University, first I learned java, C++ and PHP. In the company, I'm developing web services by Rails. I do like to automation.