futoase/fluent-plugin-rewrite-tag-filter — pull request #2 by futoase (2013-10-09 10:00:43+00:00)
Title: Modified: Added config_param of use_of_first_match_tag.

# Don't merge now.

Add config_param of **use_of_first_match_tag** .
I hope use of first match tag to ```${tag}```.

**How to use**

- fluentd.conf

```

type forward
port 24224

type copy

type rewrite_tag_filter
use_of_first_match_tag \w+\.(\w+)\.
rewriterule1 type ^(\w+)$ api.${tag}.$1

type file
path /var/log/fluentd/warrior.log

type file
path /var/log/fluentd/warrior-dev.log

```

- fluent-cat command

```
> echo '{"user_id": "1000", "name": "Keiji Matsuzaki", "type": "warrior"}' | bundle ex fluent-cat hoge_game.production.api
> echo '{"user_id": "1000", "name": "Keiji Matsuzaki", "type": "warrior"}' | bundle ex fluent-cat hoge_game.development.api
```

**result**

- warrior.log (production)

```
2013-10-09T18:11:26+09:00 api.production.warrior {"user_id":"1000","name":"Keiji Matsuzaki","type":"warrior"}
```

- warrior-dev.log

```
2013-10-09T18:11:36+09:00 api.development.warrior {"user_id":"1000","name":"Keiji Matsuzaki","type":"warrior"}
```