[리눅스] 우분투에 td-agent

Ubuntu에 td-agent를 설치하는 방법

테스트 환경

$ lsb_release -d
Description:    Ubuntu 22.04.1 LTS

저장소 추가

curl https://packages.treasuredata.com/GPG-KEY-td-agent | sudo apt-key add -
echo "deb (arch=amd64) http://packages.treasuredata.com/4/ubuntu/focal/ focal contrib" | sudo tee /etc/apt/sources.list.d/treasure-data.list

저장소 패키지 업데이트

apt-get update

td 에이전트 설치

sudo apt-get install -y td-agent
$ sudo apt-get install -y td-agent
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 td-agent : Depends: libssl1.1 (>= 1.1.1) but it is not installable
E: Unable to correct problems, you have held broken packages.

libssl1.1 설치

libssl1.1 다운로드 페이지: http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/


wget -q http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb
dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb
$ dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb
Selecting previously unselected package libssl1.1:amd64.
(Reading database ... 132567 files and directories currently installed.)
Preparing to unpack libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.21) ...
Setting up libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.21) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...

td 에이전트 재설치

sudo apt-get install -y td-agent
$ sudo apt-get install -y td-agent
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  libntfs-3g89
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  td-agent
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 10.6 MB of archives.
After this operation, 64.6 MB of additional disk space will be used.
Get:1 http://packages.treasuredata.com/4/ubuntu/focal focal/contrib amd64 td-agent amd64 4.4.2-1 (10.6 MB)
Fetched 10.6 MB in 0s (56.0 MB/s) 
Selecting previously unselected package td-agent.
(Reading database ... 132577 files and directories currently installed.)
Preparing to unpack .../td-agent_4.4.2-1_amd64.deb ...
Unpacking td-agent (4.4.2-1) ...
Setting up td-agent (4.4.2-1) ...
Adding system user `td-agent' (UID 117) ...
Adding new group `td-agent' (GID 124) ...
Adding new user `td-agent' (UID 117) with group `td-agent' ...
Creating home directory `/var/lib/td-agent' ...
Created symlink /etc/systemd/system/multi-user.target.wants/td-agent.service → /lib/systemd/system/td-agent.service.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Scanning processes...                                                                                                                         
Scanning linux images...

td-agent 버전 확인

td-agent --version
$ td-agent --version
td-agent 4.4.2 fluentd 1.15.3 (e89092ce1132a933c12bb23fe8c9323c07ca81f5)

td-agent 구성 파일 확인

$ cat /etc/td-agent/td-agent.conf | egrep -v '$^|^#'
<match td.*.*>
  @type tdlog
  @id output_td
  apikey YOUR_API_KEY
  auto_create_table
  <buffer>
    @type file
    path /var/log/td-agent/buffer/td
  </buffer>
  <secondary>
    @type file
    path /var/log/td-agent/failed_records
  </secondary>
</match>
<match debug.**>
  @type stdout
  @id output_stdout
</match>
<source>
  @type forward
  @id input_forward
</source>
<source>
  @type http
  @id input_http
  port 8888
</source>
<source>
  @type debug_agent
  @id input_debug_agent
  bind 127.0.0.1
  port 24230
</source>

td-agent 실행

systemctl --now enable td-agent

td-agent 구성 파일 편집

vim /etc/td-agent/td-agent.conf

td-agent 실행

systemctl restart td-agent