質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Fluentd

Fluentdは、オープンソースのログ収集ツールです。ログの収集方法、ログの記録先などのログデータ処理を柔軟にカスタマイズでき、インプットおよびアウトプットが全てプラグインとして実装されています。

Q&A

解決済

1回答

4611閲覧

Fluentdで発生するエラー(「failed to initialize connection」など)の解決について

skytree

総合スコア11

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Fluentd

Fluentdは、オープンソースのログ収集ツールです。ログの収集方法、ログの記録先などのログデータ処理を柔軟にカスタマイズでき、インプットおよびアウトプットが全てプラグインとして実装されています。

0グッド

0クリップ

投稿2017/03/16 07:07

Fluentd(td-agent2)を用いてApache(2.2.15)のログをPostgresql(9.6.0)に格納しようとしています。
一通り、設定が完了したのですが、fluentdで以下のエラーが発生しており、上手く動作しません。
お手数ですが、問題解決に向けてアドバイスを頂けないでしょうか。宜しくお願いします。

◆td-agent.logのログ

2017-03-09 14:58:44 +0900 [info]: following tail of /var/log/httpd/access_log
2017-03-09 03:07:01 +0900 [warn]: suppressed same stacktrace
2017-03-09 11:13:14 +0900 [warn]: retry count exceededs limit.
2017-03-09 11:13:14 +0900 [warn]: suppressed same stacktrace
2017-03-09 11:13:14 +0900 [error]: throwing away old logs.
2017-03-09 14:58:42 +0900 [info]: shutting down fluentd
2017-03-09 14:58:42 +0900 [info]: shutting down input type="tail" plugin_id="object:3f9a8b9abae0"
2017-03-09 14:58:42 +0900 [info]: shutting down output type="pgjson" plugin_id="object:3f9a8b5716f0"
2017-03-09 14:58:42 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'

<source> tag apache.access port 5432 time_col time 2017-03-09 14:58:44 +0900 [info]: following tail of /var/log/httpd/access_log 2017-03-09 03:07:01 +0900 [warn]: suppressed same stacktrace 2017-03-09 11:13:14 +0900 [warn]: retry count exceededs limit. 2017-03-09 11:13:14 +0900 [warn]: suppressed same stacktrace 2017-03-09 11:13:14 +0900 [error]: throwing away old logs. 2017-03-09 14:58:42 +0900 [info]: shutting down fluentd 2017-03-09 14:58:42 +0900 [info]: shutting down input type="tail" plugin_id="object:3f9a8b9abae0" 2017-03-09 14:58:42 +0900 [info]: shutting down output type="pgjson" plugin_id="object:3f9a8b5716f0" 2017-03-09 14:58:42 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize' <source> tag apache.access port 5432 time_col time 2017-03-09 14:58:44 +0900 [info]: following tail of /var/log/httpd/access_log host localhost port 5432 time_col time 2017-03-09 14:58:44 +0900 [info]: following tail of /var/log/httpd/access_log <source> tag apache.access port 5432 time_col time 2017-03-09 14:58:44 +0900 [info]: following tail of /var/log/httpd/access_log 2017-03-09 14:58:44 +0900 [info]: gem 'fluentd' version '0.12.31' 2017-03-09 14:58:44 +0900 [info]: adding match pattern="apache.access" type="pgjson" 2017-03-09 14:58:44 +0900 [info]: adding source type="tail" 2017-03-09 14:58:44 +0900 [info]: using configuration file: <ROOT> <source> type tail format apache path /var/log/httpd/access_log pos_file /var/log/td-agent/pos/apache.test.log.pos tag apache.access </source> <match apache.access> type pgjson host localhost port 5432 database weblog table fluentd user postgres password xxxxxx time_col time tag_col tag record_col record </match> </ROOT> 2017-03-09 14:58:44 +0900 [info]: following tail of /var/log/httpd/access_log 2017-03-09 14:59:44 +0900 [warn]: temporarily failed to flush the buffer. next_retry=2017-03-09 14:59:45 +0900 error_class="RuntimeError" error="failed to initialize connection: FATAL: \xE3\x83\xA6\xE3\x83\xBC\xE3\x82\xB6\"postgres\"\xE3\x81\xAEIdent\xE8\xAA\x8D\xE8\xA8\xBC\xE3\x81\xAB\xE5\xA4\xB1\xE6\x95\x97\xE3\x81\x97\xE3\x81\xBE\xE3\x81\x97\xE3\x81\x9F\n" plugin_id="object:3fde721ebd34" 2017-03-09 14:59:44 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-pgjson-0.0.8/lib/fluent/plugin/out_pgjson.rb:71:in `rescue in init_connection' 2017-03-09 14:59:44 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-pgjson-0.0.8/lib/fluent/plugin/out_pgjson.rb:64:in `init_connection' 2017-03-09 14:59:44 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-pgjson-0.0.8/lib/fluent/plugin/out_pgjson.rb:41:in `write' 2017-03-09 14:59:44 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/buffer.rb:354:in `write_chunk' 2017-03-09 14:59:44 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/buffer.rb:333:in `pop' 2017-03-09 14:59:44 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/output.rb:342:in `try_flush' 2017-03-09 14:59:44 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.31/lib/fluent/output.rb:149:in `run' 2017-03-09 14:59:45 +0900 [warn]: temporarily failed to flush the buffer. next_retry=2017-03-09 14:59:47 +0900 error_class="RuntimeError" error="failed to initialize connection: FATAL: \xE3\x83\xA6\xE3\x83\xBC\xE3\x82\xB6\"postgres\"\xE3\x81\xAEIdent\xE8\xAA\x8D\xE8\xA8\xBC\xE3\x81\xAB\xE5\xA4\xB1\xE6\x95\x97\xE3\x81\x97\xE3\x81\xBE\xE3\x81\x97\xE3\x81\x9F\n" plugin_id="object:3fde721ebd34" 2017-03-09 14:59:45 +0900 [warn]: suppressed same stacktrace 2017-03-09 14:59:47 +0900 [warn]: temporarily failed to flush the buffer. next_retry=2017-03-09 14:59:50 +0900 error_class="RuntimeError" error="failed to initialize connection: FATAL: \xE3\x83\xA6\xE3\x83\xBC\xE3\x82\xB6\"postgres\"\xE3\x81\xAEIdent\xE8\xAA\x8D\xE8\xA8\xBC\xE3\x81\xAB\xE5\xA4\xB1\xE6\x95\x97\xE3\x81\x97\xE3\x81\xBE\xE3\x81\x97\xE3\x81\x9F\n" plugin_id="object:3fde721ebd34"

◆◆td-agentの設定

<source> type tail format apache path /var/log/httpd/access_log pos_file /var/log/td-agent/pos/apache.test.log.pos tag apache.access </source> <match apache.access> type pgjson host localhost port 5432 database weblog table fluentd user postgres password XXXXXXXX time_col time tag_col tag record_col record </match>

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

pg_hba.confがidentになっていたことに起因してました。trustやその他で解決しました。ありがとうございます。

投稿2017/03/16 11:16

skytree

総合スコア11

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問