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 td-agent server on the EC2 of aws

English 日本語 Abstract Hello everyone, It’s candle. In this time we will build up td-agent environment on the ec2. Precondition You have a EC2.

Collect the Rails 4 production.log with td-agent

English 日本語 Abstract Hello everybody, It’s me candle. In this time, let’s get the rails 4 production.log by td-agent. I have been written same article, but there was lack of explanation and etc, I will rewrite it again. Also, I will show you how to get Rails 5 production.log at a later date. Precondition You must be able to execute ruby on rails in production mode. It is ok in any environment as long as it has executable. Such as webrick, nginx, puma and apache. td-agent or fluentd is instlled. It is assumed that td-agent or fluentd is installed.

React + S3 + Route53 + CloudFront HTTPS connection using SSL

Abstract Hello everyone it’s me candle. This time we would like to try SSL connection with the React web application deployed to S3. Programers recently develop web services on the API server and React front end. Then SSL connection is often required on the React side as well. Not only that, but recently https is being standardized. We try to taht. Condition React web is deployed to S3 You have the S3 bucket that name is same as Route53 domain name Create a CloudFront distribution First we will create the distribution of CloudFront. Go to the CloudFront management console, select …

Collect Rails 5 production.log with td-agent

English 日本語 Abstract Hello everybody It’s me candle. In this article I will show you how to collect rails 5 production.log with td-agent. Rails 5 was changed log format and it cause some problem. I will solve it and explain. relational article If you are using rails 4 please refer to the following article. td-agentでRails 4のproduction.logを取得する Precondition You can work ruby on rails in production mode Before read this article you setup the rails production environment such as webrick, apache, puma and nginx. You already installed td-agent or fluentd. You need td-agent or fluentd. It is installed on the ruby …


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.