# TD Agent Using Scribe Protocol to Store Logs
Treasure Agent (td-agent) understands the Scribe protocol (Thrift-based). td-agent can co-exist or replace your existing Scribe infrastructure.
See [fluent-plugin-scribe](https://github.com/fluent/fluent-plugin-scribe). The plugin also supports Scribe *output*.
* [Prerequisites](/products/customer-data-platform/integration-hub/streaming/td-agent/td-agent-using-scribe-protocol-to-store-logs#prerequisites)
* [Specifying Use of Scribe Input](/products/customer-data-platform/integration-hub/streaming/td-agent/td-agent-using-scribe-protocol-to-store-logs#specifying-use-of-scribe-input)
* [Messages as JSON String](/products/customer-data-platform/integration-hub/streaming/td-agent/td-agent-using-scribe-protocol-to-store-logs#messages-as-json-string)
* [Other Formats](/products/customer-data-platform/integration-hub/streaming/td-agent/td-agent-using-scribe-protocol-to-store-logs#other-formats)
# Prerequisites
* Basic knowledge of Treasure Data, including the [TD Toolbelt](http://docs.treasuredata.com/display/PD/Using+TD+Toolbelt?atlOrigin=https://treasuredata.clickhelp.co/articles/#!project-product-documentation/td-toolbelt).
* Basic knowledge of td-agent.
# Specifying Use of Scribe Input
The following configuration enables the Scribe input plugin:
```conf
type scribe
port 1463
```
The `category` field of the Scribe protocol is used as a `tag` for td-agent. If you want to store your data in the www_access table within the test_db database, send your LogEntry as follows (Ruby example).
```ruby
LogEntry.new
entry.category = 'td.test_db.www_access'
entry.message = 'abcde'
client.Log([entry])
```
This message is organized as follows.
```ruby
{
message => 'abcde'
}
```
# Messages as JSON String
The message field of semi-structured data often contains JSON strings. td-agent uses the *msg_format* option to parse the JSON string in-place.
```conf
type scribe
port 1463
msg_format json
```
Send records as follows. Note that entry.message is a JSON string.
```ruby
entry = LogEntry.new
entry.category = 'td.test_db.www_access'
entry.message = {'a' => 'b', 'c' => d}.to_json
client.Log([entry])
```
This message is organized as follows.
```ruby
{
'a' => 'b',
'c' => 'd',
}
```
# Other Formats
The *msg_format* option supports `text`, `json`, and `url_param`. The format for `url_param` is as follows.
`key1=val1&key2=val2&key3=val3`