# Setting Up TD Agent
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.
```conf
# HTTP input
type http
port 8888
# Treasure Data output
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
```
`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](/products/my-settings/getting-your-api-keys) is recommended.
# Restart the td-agent Service
```bash
# 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
```