After installing Treasure Agent (td-agent), you can modify your config file. The file can be found in /etc/td-agent/td-agent.conf.
The config file comes with some sample settings. You will find the following lines in your config. Specify your API key by setting the apikey option. You can view your API key from the TD Console.
# HTTP input
<source>
type http
port 8888
</source>
# Treasure Data output
<match td.*.*>
type tdlog
endpoint api-import.treasuredata.com
apikey YOUR_API_KEY
auto_create_table
buffer_type file
buffer_path /var/log/td-agent/buffer/td
use_ssl true
num_threads 8
</match>YOUR_API_KEY should be your actual apikey string. You can retrieve your API key from your profiles in TD Console. Using a write-only API key is recommended.
# Linux
sudo /etc/init.d/td-agent restart
# macOS
sudo launchctl unload /Library/LaunchDaemons/td-agent.plist
sudo launchctl load /Library/LaunchDaemons/td-agent.plist