• Stars
    star
    149
  • Rank 246,959 (Top 5 %)
  • Language
    Ruby
  • License
    Other
  • Created over 12 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

fluent-plugin-forest

NOTE: This plugin will not be updated: Use Fluentd v0.14 native API to handle tags.

This is a plugin for Fluentd.

Component

ForestOutput

ForestOutput creates sub plugin instance of a output plugin dynamically per tag, from template configurations. In template configurations, you can write configuration lines for overall tags by <template>, and for specified tags by <case TAG_PATTERN>, and you can use __TAG__ (or ${tag}) placeholder at anywhere in <template> and <case>.

This plugin helps you if you are writing very long configurations by copy&paste with a little little diff for many tags.

Other supported placeholders:

  • __HOSTNAME__ (or ${hostname})
    • replaced with string specified by 'hostname' configuration value, or (default) result of 'hostname' command
  • __ESCAPED_TAG__ (or ${escaped_tag})
    • replaced with escaped tag. Escaped tag is replaced '.' with a character specified by 'escape_tag_separator' (default: '_')
  • __TAG_PARTS[n]__ (or ${tag_parts[n]})
    • it acts accessing the index which split the tag with '.' (dot). It will get 'td' by ${tag_parts[0]}, 'apache' by ${tag_parts[1]} and 'access' by ${tag_parts[-1]} when the tag was td.apache.access.
    • you can also use range index like '1..4' or '1...3' (e.g. ${tag_parts[1..-1]} will return 'apache.access' on giving tag same as previous.)

You SHOULD NOT use ForestOutput for tags increasing infinitly.

Configuration

NOTICE: If you configure fluent-plugin-forest with buffer_type file (or plugins, default buffer type is file), you should modify buffer_path with __TAG__ (or ${tag}) to help to use buffer files for each tags.

ForestOutput

If you are writing long long configurations like below:

<match service.blog>
  @type file
  time_slice_format %Y%m%d%H
  compress gz
  path /var/log/blog.*.log
</match>
<match service.portal>
  @type file
  time_slice_format %Y%m%d%H
  compress gz
  path /var/log/portal.*.log
</match>
<match service.news>
  @type file
  time_slice_format %Y%m%d%H
  compress gz
  path /var/log/news.*.log
</match>
<match service.sns>
  @type file
  time_slice_format %Y%m%d%H
  compress gz
  path /var/log/sns.*.log
</match>
# ...

You can write configuration with ForestOutput like below:

<match service.*>
  @type forest
  subtype file
  remove_prefix service
  <template>
    time_slice_format %Y%m%d%H
    compress gz
    path /var/log/${tag}.*.log
  </template>
</match>

If you want to place logs /var/archive for service.search.** as filename with hostname, without compression, case directive is useful:

<match service.*>
  @type forest
  subtype file
  remove_prefix service
  <template>
    time_slice_format %Y%m%d%H
  </template>
  <case search.**>
    path /var/archive/__TAG__.__HOSTNAME__.*.log
  </case>
  <case *>
    compress gz
    path /var/log/__TAG__.*.log
  </case>
</match>

case configuration overwrites template configuration, so you can also write like this:

<match service.*>
  @type forest
  subtype file
  remove_prefix service
  <template>
    time_slice_format %Y%m%d%H
    compress gz
    path /var/log/__TAG__.*.log
  </template>
  <case search.**>
    path /var/archive/__TAG__.*.log
  </case>
</match>

Version 0.2.0 or later, subsections adding/overwriting are supported. About the case below, three <store> subsections are defined for search.** pattern.

<match service.*>
  @type forest
  subtype copy
  <template>
    <store>
      @type file
      path /path/to/copy1
    </store>
    <store>
      @type file
      path /path/to/copy2
    </store>
  </template>
  <case search.**>
    <store>
      @type file
      path /path/to/copy3
    </store>
  </case>
</match>

Subsections with same arguments will be overwritten. See this example:

<match service.*>
  @type forest
  subtype route
  <template>
    <route {search,admin}.a>
      add_prefix first
    </route>
    <route {search,admin}.b>
      add_prefix second
    </route>
    <route {search,admin}.c>
      add_prefix third
    </route>
    <route {search,admin}.*>
      add_prefix extra
    </route>
  </template>
  <case admin.*>
    <route {search,admin}.*>
      add_prefix other
    </route>
  </case>
</match>

In this case, <route {search,admin}.*> subsection will be overwritten to add prefix 'other' for tag service.admin.*.

For Configuration DSL

In DSL configurations, case is reserved by Ruby itself. Use pattern instead of case. pattern works just as same as case. (v0.3.0 or later.)

TODO

  • patches welcome!

Copyright

  • Copyright (c) 2012- TAGOMORI Satoshi (tagomoris)
  • License
    • Apache License, Version 2.0

More Repositories

1

shib

WebUI for query engines: Hive and Presto
JavaScript
200
star
2

xbuild

Language runtimes installer for production environment
Shell
197
star
3

deferral

Golang-style defer in Ruby
Ruby
175
star
4

fluent-plugin-secure-forward

Ruby
140
star
5

presto-client-node

Distributed query engine Presto client library for node.js
JavaScript
126
star
6

fluent-plugin-mysql

Ruby
91
star
7

fluent-agent-lite

Lightweight log delivery agent works w/ fluentd
Perl
79
star
8

fluent-plugin-parser

Ruby
75
star
9

fluent-plugin-flowcounter

TODO: one-line summary of your gem
Ruby
54
star
10

fluent-plugin-datacounter

Ruby
47
star
11

mysql2-cs-bind

'mysql2' extension to add pseudo prepared statement
Ruby
38
star
12

fluent-plugin-growthforecast

TODO: one-line summary of your gem
Ruby
37
star
13

maccro

Macro in Ruby
Ruby
30
star
14

fluent-plugin-file-alternative

Ruby
25
star
15

fluent-plugin-ping-message

Ruby
24
star
16

yabitz

Yet Another Business Information Tracker Z: host management application
Ruby
22
star
17

fluent-plugin-sampling-filter

TODO: one-line summary of your gem
Ruby
22
star
18

msgpack-inspect

A tool to inspect and dump the MessagePack binary data: msgpack.org[msgpack-inspect]
Ruby
20
star
19

fluent-plugin-route

This is copy of frsyuki's out_route
Ruby
20
star
20

fluent-plugin-numeric-monitor

Ruby
19
star
21

fluent-plugin-notifier

Ruby
18
star
22

rb-growthforecast

Ruby
17
star
23

astarisk

AST visualizer, named from "AST a risk"
Ruby
16
star
24

right_speed

Ruby
15
star
25

fluent-plugin-config-expander

Ruby
14
star
26

fluent-plugin-numeric-counter

Ruby
12
star
27

with_resources

Add "with" method in Ruby to allocate/release resources in safe way
Ruby
11
star
28

Apache-Log-Parser

Log Parser for Apache common, combined and other custom styles
Perl
11
star
29

fluent-mixin-config-placeholders

Ruby
10
star
30

fluent-plugin-pull_forward

Ruby
10
star
31

LFA

Web application framework to perform as Lambda Function Adapter
Ruby
8
star
32

scribe_line

Python script collection for log transfer with scribe
Python
7
star
33

binding-slicer

Let you write binding[:a, :b, :c] => Hash {a: a, b: b, c: c}
Ruby
7
star
34

fluent-plugin-hoop

TODO: one-line summary of your gem
Ruby
6
star
35

mysqldef_lambda_package

Docker container and scripts to run k0kubun/mysqldef
JavaScript
6
star
36

shibui

Perl
6
star
37

p5-Net-GrowthForecast

Client library for GrowthForecast
Perl
6
star
38

fluent-plugin-buffer-lightening

Ruby
6
star
39

stratum

O/R mapper library for ruby and MySQL on additional architecture
Ruby
6
star
40

fluent-mixin-plaintextformatter

Ruby
5
star
41

fluent-agent

Perl
4
star
42

fluent-plugin-ikachan

Ruby
4
star
43

fluentd-leak-test

Ruby
4
star
44

logstash-output-fluentd

Logstash plugin to forward data to Fluentd
Ruby
4
star
45

fluent-helper-plugin-spec

RSpec helper for Fluentd plugin development
Ruby
4
star
46

Net-Hadoop-DFSAdmin-ReportParser

Perl
4
star
47

fluent-plugin-dummydata-producer

Ruby
3
star
48

itunesconnect-reviews-bookmarklet

bookmarklet to load all reviews from all of countries in iTunes Connect
3
star
49

passenger-monitor

HTTP interface same as mod_status for passenger-status
Ruby
3
star
50

remote_driver

Python
3
star
51

fluentd-tester

Ruby
3
star
52

fluent-plugin-encrypt

Ruby
3
star
53

fluent-plugin-ruby-memory-usage-profiler

Fluentd plugin to output memory profiler information for debugging of ruby/fluentd itself
Ruby
3
star
54

fluentd-book-samples

Ruby
3
star
55

fluentd-v1-checker

Ruby
2
star
56

Net-Hadoop-WebHDFS

Perl
2
star
57

Net-Hadoop-Hive-QueryBuilder

Perl
2
star
58

ruby-memory-usage-profiler

Ruby
2
star
59

fluent-plugin-amplifier-filter

Ruby
2
star
60

scribed_launcher

start-stop script for facebook scribed
Python
2
star
61

isucon3-final-code

Perl
2
star
62

simpleoauth-gae

OAuth 1.0 library for Python on Google App Engine
Python
2
star
63

Net-Hadoop-Hoop

Hoop client library perl module
Perl
2
star
64

MessagePack-RPC-HTTP-Client

Perl
2
star
65

whada

Web Authentication Data Aggregator
Perl
2
star
66

fluent-plugin-reducer

TODO: one-line summary of your gem
Ruby
1
star
67

fluent-plugin-buffered-stdout

Ruby
1
star
68

fluent-plugin-http_file_upload

Ruby
1
star
69

ruby-cli

Ruby
1
star
70

node-scribed

facebook scribe server implementation on node.js (highly experimental)
JavaScript
1
star
71

fluent-plugin-deparser

Ruby
1
star
72

fluent-plugin-delay-inspector

Ruby
1
star
73

isucon7-elimination

Ruby
1
star
74

demo-webapps

Very simple Ruby webapps to verify app servers
Ruby
1
star
75

dyna_mo

Dynamic scope implementation for method overriding
Ruby
1
star
76

fluent-plugin-flatten-filter

Ruby
1
star
77

woothee-sqale

Ruby
1
star
78

logstash-output-treasure_data

Logstash output plugin to store data on Treasure Data service https://www.treasuredata.com/
Ruby
1
star
79

Net-Hadoop-HuahinManager

client library for Huahin Manager
Perl
1
star
80

fluent-plugin-test-counter

TODO: one-line summary of your gem
Ruby
1
star