Kouhei Sutou
null+****@clear*****
Sun Nov 2 23:46:47 JST 2014
Kouhei Sutou 2014-11-02 23:46:47 +0900 (Sun, 02 Nov 2014) New Revision: 9889b9e343d85ca54474206a26d9cd6974234e62 https://github.com/groonga/packages.groonga.org/commit/9889b9e343d85ca54474206a26d9cd6974234e62 Message: Install Fluentd to store logs to Droonga Added files: ansible/files/fluentd/fluentd.conf Modified files: ansible/playbook.yml Added: ansible/files/fluentd/fluentd.conf (+48 -0) 100644 =================================================================== --- /dev/null +++ ansible/files/fluentd/fluentd.conf 2014-11-02 23:46:47 +0900 (5f5410f) @@ -0,0 +1,48 @@ +<source> + type debug_agent + bind 127.0.0.1 + port 24230 +</source> + +<source> + type tail + path /var/log/apache2/access.log + pos_file /var/log/td-agent/apache2_access.pos + tag apache.raw.log.www.access + format apache2 +</source> + +<match apache.**> + type record_reformer + enable_ruby false + + tag ${tag_suffix[1]} + + <record> + remote ${host} + </record> +</match> + +<match raw.log.**> + type record_reformer + enable_ruby false + + tag ${tag_suffix[1]} + + <record> + host ${hostname} + type ${tag_parts[2]} + </record> +</match> + +<match log.**> + type groonga + table Logs + + protocol http + host 127.0.1.1 + + buffer_type file + buffer_path /var/spool/td-agent/buffer/groonga + flush_interval 1 +</match> Modified: ansible/playbook.yml (+42 -0) =================================================================== --- ansible/playbook.yml 2014-11-02 23:20:35 +0900 (9160dbf) +++ ansible/playbook.yml 2014-11-02 23:46:47 +0900 (9f26913) @@ -217,6 +217,45 @@ notify: - Restart droonga-http-server + # Fluentd + - name: Install GPG key of Fluentd APT repository + apt_key: + url=http://packages.treasuredata.com/GPG-KEY-td-agent + - name: Install Fluentd APT repository + apt_repository: + repo="deb [arch=amd64] http://packages.treasuredata.com/2/ubuntu/trusty/ trusty contrib" + - name: Install Fluentd + apt: name={{ item }} + with_items: + - td-agent + - name: Install Fluentd plugins + gem: + executable=/usr/sbin/td-agent-gem + name={{ item }} + user_install=no + with_items: + - fluent-plugin-record-reformer + - fluent-plugin-groonga + - name: Add "td-agent" user to "adm" groups + user: + name=td-agent + groups=adm + - name: Create directories + file: + path={{ item }} + state=directory + owner=td-agent + group=td-agent + with_items: + - /var/spool/td-agent/ + - /var/spool/td-agent/buffer/ + - name: Put fluentd.conf + copy: + src=files/fluentd/fluentd.conf + dest=/etc/td-agent/td-agent.conf + notify: + - Restart Fluentd + handlers: - name: Restart Apache service: name=apache2 state=restarted @@ -256,3 +295,6 @@ --daemon args: chdir: ~droonga-http-server/droonga + + - name: Restart Fluentd + service: name=td-agent state=restarted -------------- next part -------------- HTML����������������������������...Download