ja:
tutorials:
index:
page_title: チュートリアル
step1: "fluentdをセットアップ"
step2: "fluentdを起動"
start_tutorial: "チュートリアルを始める"
chapter1:
page_title: "Chapter 1 | データを渡してみる"
description: fluentdに任意のデータをJSONで送ることができます。URLのパスがタグの名前になります。
learn_more: |
他にもin_tail, in_syslogなどのinputプラグインがあります。
Learn More
send: 送信
chapter2:
page_title: "Chapter 2 | in_httpとout_stdout"
lesson_markdown: |
fluentdの起動時にこのようなログがあるかと思います。
2014-06-05 14:43:14 +0900 [info]: adding source type="http"
2014-06-05 14:43:14 +0900 [info]: adding match pattern="debug.*" type="stdout"
この1行目でhttpが有効化されています。これでHTTPリクエストを受け付けるようになります。
2行目でstdoutが有効化されています。受け取ったデータのうち、タグが`debug.*`にマッチするものはstdoutへと渡されます。
この2つはfluent.confでそれぞれ次のように設定されています。
type http
port %{http_port}
type stdout
chapter3:
page_title: "Chapter 3 | fluentdを構築しよう!"
lesson_markdown: |
fluentdはHTTP以外にも[syslogプロトコル](http://docs.fluentd.org/ja/articles/in_syslog)や[ファイル](http://docs.fluentd.org/ja/articles/in_tail)を入力として受け取ることができます。
また出力についても、stdout以外に[MongoDB](http://docs.fluentd.org/ja/articles/out_mongo)や[AWS S3](http://docs.fluentd.org/ja/articles/out_s3)などを出力先として指定できます。

これらはプラグインとして提供されています。プラグインをインストールし、設定ファイルに追記してfluentdを再起動すると使用可能となります。
[数多くのプラグイン](/plugins/recommended)がありますので、用途にあったものを探して使いましょう! 設定ファイルは[ここから編集できます。](%{edit_config_url})
chapter4:
page_title: "Chapter 4 | 設定事例"
lesson_markdown: |
### 例:Apacheの5xxレスポンスを検知してメールを送る
**必要なプラグイン**
- fluent-plugin-grepcounter
- fluent-plugin-mail
**設定ファイル例**
type tail
format apache2
path /var/log/apache2/access.log #This is the location of your Apache log
tag apache.access
type grepcounter
count_interval 3 # Time window to grep and count the # of events
input_key code # We look at the (http status) "code" field
regexp ^5\d\d$ # This regexp matches 5xx status codes
threshold 1 # The # of events to trigger emitting an output
add_tag_prefix error_5xx # The output event's tag will be error_5xx.apache.access
# The event that comes here looks like
# {
# "count":1,
# "input_tag":"error_5xx.apache.access",
# "input_tag_last":"access",
# "message":[500]
# }
type mail
host smtp.gmail.com # This is for Gmail and Google Apps. Any SMTP server should work
port 587 # port for smtp.gmail.com
user example@gmail.com # your Gmail here for login
password XXXXXX # Gmail password
enable_starttls_auto true # Gmail required this
from YOUR_SENDER_EMAIL_HERE
to YOUR_RECIPIENT_EMAIL_HERE
subject [URGENT] APACHE 5XX ERROR
message Total 5xx error count: %s\n\nPlease check your Apache webserver ASAP
message_out_keys count # The value of 'count' will be substituted into %s above.
**処理の流れ**
[log file] ->
(in_tail) ->
apache.accessタグでfluentdに取り込む ->
(apache.accessにマッチ) ->
grepcounterがタグにprefixを追加して再送 ->
(error_5xx.apache.accessにマッチ) ->
mailがメール送信
chapter5:
page_title: "Chapter 5 | チュートリアル完了"
lesson_markdown: |
以上でチュートリアルは終了です。お疲れさまでした!
関連リソース:
- [クイックスタートガイド](http://docs.fluentd.org/ja/articles/quickstart)
- [メーリングリスト](https://groups.google.com/forum/?fromgroups#!forum/fluentd)
- [ソースコード(GitHub)](https://github.com/fluent/fluentd)
- [Twitter @fluentd](https://twitter.com/fluentd)