y-ken/fluent-plugin-rewrite-tag-filter — pull request #7 by futoase (2013-10-10 09:27:33+00:00)
Title: Added config param of use of first match tag

# Added new config_param.

**An proposal. :)**

Add config_param of **use_of_first_match_tag_regexp** .
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_regexp \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
```

**results**

- warrior.log (production)

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

- warrior-dev.log

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