Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed broken link


  • Basic knowledge of PHP.

  • Basic knowledge of Treasure Data, including the TD Toolbelt.

  • PHP 5.3 or higher (for local testing).

The fluent-logger-php library does not work in Heroku (here's why).

Installing td-agent

Install td-agenton your application servers. td-agent sits within your application servers, focusing on uploading application logs to the cloud.


You can choose Amazon Linux 1 or Amazon Linux 2. Refer to Installing td-agent on Amazon AWS Linux.

MacOS X 10.11+

Code Block
$ open ''

MacOS X 10.11.1 (El Capitan) introduces some security changes. After the td-agent is installed, edit the /Library/LaunchDaemons/td-agent.plist file to change /usr/sbin/td-agent to /opt/td-agent/usr/sbin/td-agent.

Windows Server 2012+

The Windows installation requires the steps detailed in:


Code Block
# Unix Domain Socket Input
  type unix
  path /var/run/td-agent/td-agent.sock

# Treasure Data Output
<match td.*.*>
  type tdlog
  apikey YOUR_API_KEY
  buffer_type file
  buffer_path /var/log/td-agent/buffer/td
  use_ssl true

YOUR_API_KEY should be your actual apikey string. Using a [write-only API key](access-control#rest-apis-access) is recommended.

Restart your agent when the following lines are in place.


Code Block
$ td tables
| Database   | Table      | Type | Count     |
| test_db    | test_table | log  | 1         |
| test_db    | follow     | log  | 1         |

The first argument of post() determines the database name and table name. If you specify `td.test_db.test_table`, the data is imported into the table *test_table* within the database *test_db*. They are automatically created at upload time.

Tips on Production Deployment