# TD Agent Reference The following files are installed by the rpm or Debian packages. ## td-agent 4.x | **Resource** | **Location** | **Notes** | | --- | --- | --- | | Config Directory | /etc/td-agent/ | | | Config File | /etc/td-agent/td-agent.conf | This config will be picked-up by the startup script | | Startup Script | /usr/lib/systemd/system/td-agent.serviceOR /etc/init.d/td-agent | | | Log Directory | /var/log/td-agent/ | | | Plugin Directory | /etc/td-agent/plugin/ | Your custom plugins go here. | | Ruby Interpreter | /opt/td-agent/bin/ruby | Ruby v2.7 is bundled with the package. | | Rubygems | /usr/sbin/td-agent-gem | Bundled rubygems to install fluentd plugins. For example: /usr/sbin/td-agent-gem install fluent-plugin-mongo | | jemalloc | /opt/td-agent/lib/libjemalloc.so | [jemalloc](http://jemalloc.net/) is bundled together to avoid memory fragmentation. It is loaded by default in the startup script. | ## td-agent 3.x | **Resource** | **Location** | **Notes** | | --- | --- | --- | | Config Directory | /etc/td-agent/ | | | Config File | /etc/td-agent/td-agent.conf | This config will be picked-up by the startup script | | Startup Script | /usr/lib/systemd/system/td-agent.serviceOR /etc/init.d/td-agent | Log Directory | | Plugin Directory | /etc/td-agent/plugin/ | Your custom plugins go here. | | Ruby Interpreter | /opt/td-agent/embedded/bin/ruby | Ruby v2.4 is bundled with the package. | | Rubygems | /usr/sbin/td-agent-gem | Bundled rubygems to install fluentd plugins. For example: `/usr/sbin/td-agent-gem install fluent-plugin-mongo` | | jemalloc | /opt/td-agent/embedded/lib/libjemalloc.so | [jemalloc](http://jemalloc.net/) is bundled together to avoid memory fragmentation. It is loaded by default in the startup script. | # Supervision, Privileges and Network Ports When td-agent starts, it launches 2 processes: parent and child. The parent process is managing the life cycle of the child process, and the child process handles actual log collection. ```bash $ ps w -C ruby -C fluentd --no-heading ``` ```bash 26238 ? Sl 0:00 /opt/td-agent/embedded/bin/ruby /opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/td-agent.log --daemon /var/run/td-agent/td-agent.pid 26243 ? Sl 0:25 /opt/td-agent/embedded/bin/ruby -Eascii-8bit:ascii-8bit /opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/td-agent.log --daemon /var/run/td-agent/td-agent.pid --under-supervisor ``` Both processes run as the `td-agent` user under `td-agent` group and all forked subprocesses run as the same. This applies to any system call initiated by td-agent as well. The agent configuration resides at /etc/td-agent/td-agent.conf. All configurations must be readable by td-agent. The following ports are open depending on your input. * in_tail: nothing * in_forward: tcp/24224, udp/24224 * in_unix: `/var/run/td-agent/td-agent.sock` For secure uploading to Treasure Data, you must open tcp/443 (https) for `*.treasuredata.com`.