mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-16 00:06:10 +02:00
118 lines
4.4 KiB
YAML
118 lines
4.4 KiB
YAML
en:
|
|
tutorials:
|
|
index:
|
|
step1: "Setup fluentd"
|
|
step2: "Start fluentd"
|
|
page_title: Tutorial
|
|
start_tutorial: Start tutorial
|
|
chapter1:
|
|
page_title: "Chapter 1 | Try to send data"
|
|
description: You can send an arbitrary JSON data via HTTP. URL path will be tag name.
|
|
send: Send
|
|
chapter2:
|
|
page_title: "Chapter 2 | in_http and out_stdout"
|
|
lesson_markdown: |
|
|
You can see the log when fluentd started.
|
|
|
|
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"
|
|
|
|
Line 1 enable http plugin that allows to receive HTTP requests.
|
|
|
|
Line 2 enable stdout plugin that process the data with matched `debug.*` tag.
|
|
|
|
These settings are defined as following fluent.conf:
|
|
|
|
<source>
|
|
type http
|
|
port %{http_port}
|
|
</source>
|
|
|
|
<match debug.*>
|
|
type stdout
|
|
</match>
|
|
chapter3:
|
|
page_title: "Chapter 3 | Build your fluentd!"
|
|
lesson_markdown: |
|
|
fluentd can receive from [syslog protocol](http://docs.fluentd.org/articles/in_syslog), [file](http://docs.fluentd.org/articles/in_tail), etc.
|
|
|
|
Also fluentd can output to [MongoDB](http://docs.fluentd.org/articles/out_mongo), [AWS S3](http://docs.fluentd.org/articles/out_s3), etc.
|
|
|
|

|
|
|
|
These input/output are provided as plugin. Install them and write a setting, then restart fluentd, you can get the power!
|
|
|
|
[Many plugins](/plugins/recommended) are available. And you can [edit config file from here](%{edit_config_url}).
|
|
chapter4:
|
|
page_title: "Chapter 4 | Use case"
|
|
lesson_markdown: |
|
|
### Monitoring Apache 5xx response and email it
|
|
|
|
**Required plugins**
|
|
|
|
- fluent-plugin-grepcounter
|
|
- fluent-plugin-mail
|
|
|
|
**config file example**
|
|
|
|
<source>
|
|
type tail
|
|
format apache2
|
|
path /var/log/apache2/access.log #This is the location of your Apache log
|
|
tag apache.access
|
|
</source>
|
|
|
|
<match 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
|
|
</match>
|
|
|
|
<match 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.
|
|
</match>
|
|
|
|
**process flow**
|
|
|
|
[log file] ->
|
|
(in_tail) ->
|
|
Capturing file content with tagged as apache.access ->
|
|
(match apache.access) ->
|
|
"grepcounter" re-send data with appending prefix ->
|
|
(match error_5xx.apache.access) ->
|
|
"mail" send a mail
|
|
chapter5:
|
|
page_title: "Chapter 5 | Finish!"
|
|
lesson_markdown: |
|
|
Tutorial is over. congratulation!
|
|
|
|
Other resources:
|
|
|
|
- [Quick start](http://docs.fluentd.org/articles/quickstart)
|
|
- [Forum](https://groups.google.com/forum/?fromgroups#!forum/fluentd)
|
|
- [Source code(GitHub)](https://github.com/fluent/fluentd)
|
|
- [Twitter @fluentd](https://twitter.com/fluentd)
|
|
|