Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache td代理赢得';我不能在AmazonLinux2上工作_Apache_Systemd_Fluentd_Amazon Linux_Td Agent - Fatal编程技术网

Apache td代理赢得';我不能在AmazonLinux2上工作

Apache td代理赢得';我不能在AmazonLinux2上工作,apache,systemd,fluentd,amazon-linux,td-agent,Apache,Systemd,Fluentd,Amazon Linux,Td Agent,我想知道如何让td代理读取AmazonLinux2上的apache日志文件。 td代理似乎没有读取日志文件的权限,但我无法修复此问题。 我使用vagrant将AmazonLinux2安装到virtualbox中 参考文献。 版本 虚拟盒:5.2.16 r123759 流浪汉:流浪汉2.1.2 1使用ansible安装apache和td代理 # ansible/playbook.yml # install apache - name: install httpd (apache) bec

我想知道如何让td代理读取AmazonLinux2上的apache日志文件。 td代理似乎没有读取日志文件的权限,但我无法修复此问题。 我使用vagrant将AmazonLinux2安装到virtualbox中

参考文献。

版本

  • 虚拟盒:5.2.16 r123759
  • 流浪汉:流浪汉2.1.2
1使用ansible安装apache和td代理

# ansible/playbook.yml
# install apache
- name: install httpd (apache)
  become: yes
  yum:
    name: httpd
    state: present 

# install td-agent
 - name: install td-agent
    raw: "curl -L https://toolbelt.treasuredata.com/sh/install-amazon2- td-agent3.sh | sh"

- name: upload etc/td-agent/td-agent.conf
  become: yes
  copy: src=../etc/td-agent/td-agent.conf
        dest=/etc/td-agent/td-agent.conf
        directory_mode=yes
--


我自己解决了这个问题

下面文件中的用户和组应修改为root用户

/lib/systemd/system/td-agent.service

# /etc/td-agent/td-agent.conf
<source>
 type tail
 format apache
 path /var/log/httpd/access_log
 tag apache.access_log
 pos_file /var/log/td-agent/access_log.pos
</source>

<source>
 type tail
 format apache
 path /var/log/httpd/error_log
 tag apache.error_log
 pos_file /var/log/td-agent/error_log.pos
</source>

<match apache.**>
 type forward
 <server>
  name jobq01
  host 52.68.22.100
  port 24224
 </server>
</match>
$ sudo systemctl start td-agent.service
$ sudo systemctl status td-agent.service
● td-agent.service - td-agent: Fluentd based data collector for Treasure Data
   Loaded: loaded (/usr/lib/systemd/system/td-agent.service; disabled; vendor preset: disabled)
   Active: active (running) since 月 2018-08-06 05:24:22 UTC; 1min 1s ago
     Docs: https://docs.treasuredata.com/articles/td-agent
  Process: 5532 ExecStart=/opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/td-agent.log --daemon /var/run/td-agent/td-agent.pid $TD_AGENT_OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 5537 (fluentd)
   CGroup: /system.slice/td-agent.service
           └─5537 /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

 8月 06 05:24:21 localhost systemd[1]: Starting td-agent: Fluentd based data collector for Treasure Data...
 8月 06 05:24:22 localhost systemd[1]: Started td-agent: Fluentd based data collector for Treasure Data.