Skip to content

Commit

Permalink
Added a example about encoding to README
Browse files Browse the repository at this point in the history
  • Loading branch information
yoheimuta committed May 17, 2017
1 parent e92b5b4 commit 4c1bcec
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ every 10 seconds from AWS RDS.
</source>
```

### Example GET RDS slow_log
### Example: GET RDS slow_log

```config
<source>
Expand Down Expand Up @@ -68,3 +68,31 @@ every 10 seconds from AWS RDS.
2013-06-29 00:32:55 +0900 [error]: fluent-plugin-rds-slowlog: cannot connect RDS
```

### Example: Encode output string

Specify the encoding of output string. The default is ASCII-8BIT.

```config
<source>
...
encoding UTF-8
</source>
```

- If specify only encoding, the plugin changes string to encoding. This use ruby's [String#force_encoding](https://docs.ruby-lang.org/en/trunk/String.html#method-i-force_encoding)

```config
<source>
...
encoding CP932
from_encoding UTF-8
</source>
```

- If specify encoding and from_encoding, the plugin tries to encode string from from_encoding to encoding. This uses ruby's [String#encode](https://docs.ruby-lang.org/en/trunk/String.html#method-i-encode)

You can get supported encoding list by typing following command:

```
$ ruby -e 'p Encoding.name_list.sort'
```

0 comments on commit 4c1bcec

Please sign in to comment.