[Groonga-commit] groonga/packages.groonga.org at ca0eec6 [master] Collect access logs

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jun 1 00:19:20 JST 2015


Kouhei Sutou	2015-06-01 00:19:20 +0900 (Mon, 01 Jun 2015)

  New Revision: ca0eec6804deaae6e798d6e3ed6ec1b2b669d2e1
  https://github.com/groonga/packages.groonga.org/commit/ca0eec6804deaae6e798d6e3ed6ec1b2b669d2e1

  Message:
    Collect access logs

  Added files:
    ansible/files/groonga-httpd.conf
  Modified files:
    ansible/files/fluentd/fluentd.conf
    ansible/playbook.yml

  Modified: ansible/files/fluentd/fluentd.conf (+16 -13)
===================================================================
--- ansible/files/fluentd/fluentd.conf    2015-05-31 20:47:53 +0900 (933694e)
+++ ansible/files/fluentd/fluentd.conf    2015-06-01 00:19:20 +0900 (a89c027)
@@ -8,31 +8,34 @@
   type tail
   path /var/log/apache2/access.log
   pos_file /var/log/td-agent/apache2_access.pos
-  tag apache.raw.log.www.access
+  tag apache.log.www.access
   format apache2
 </source>
 
-<match apache.**>
-  type record_reformer
-  enable_ruby false
-
-  tag ${tag_suffix[1]}
+<filter apache.log.**>
+  type record_transformer
 
   <record>
     remote ${host}
   </record>
-</match>
-
-<match raw.log.**>
-  type record_reformer
-  enable_ruby false
+</filter>
 
-  tag ${tag_suffix[1]}
+<filter apache.log.**>
+  type record_transformer
 
   <record>
     host ${hostname}
     type ${tag_parts[2]}
   </record>
+</filter>
+
+<match apache.log.**>
+  type anonymizer
+
+  remove_tag_prefix apache.
+
+  sha1_keys remote
+  hash_salt "#{File.read('/etc/td-agent/anonymizer-salt.txt')}"
 </match>
 
 <match log.**>
@@ -40,7 +43,7 @@
   table Logs
 
   protocol http
-  host 127.0.1.1
+  host 127.0.0.1
 
   buffer_type file
   buffer_path /var/spool/td-agent/buffer/groonga

  Added: ansible/files/groonga-httpd.conf (+67 -0) 100644
===================================================================
--- /dev/null
+++ ansible/files/groonga-httpd.conf    2015-06-01 00:19:20 +0900 (678d472)
@@ -0,0 +1,67 @@
+worker_processes 1;
+
+user groonga groonga;
+
+events {
+  worker_connections 1024;
+}
+
+http {
+  include mime.types;
+  default_type application/octet-stream;
+  sendfile on;
+  keepalive_timeout 65;
+
+  groonga_database /var/lib/groonga/db/db;
+
+  groonga_database_auto_create on;
+
+  server {
+    listen 127.0.0.1:10041;
+    server_name localhost;
+
+    location /d/ {
+      groonga on;
+    }
+
+    error_page   500 502 503 504  /50x.html;
+    location = /50x.html {
+      root html;
+    }
+  }
+
+  server {
+    listen 10041;
+    server_name packages.groogna.org;
+
+    location /d/select {
+      groonga on;
+      groonga_base_path /d/;
+    }
+
+    location /d/table_list {
+      groonga on;
+      groonga_base_path /d/;
+    }
+
+    location /d/column_list {
+      groonga on;
+      groonga_base_path /d/;
+    }
+
+    location /d/status {
+      groonga on;
+      groonga_base_path /d/;
+    }
+
+    location / {
+      root /usr/share/groonga/html/admin;
+      index index.html;
+    }
+
+    error_page   500 502 503 504  /50x.html;
+    location = /50x.html {
+      root html;
+    }
+  }
+}

  Modified: ansible/playbook.yml (+68 -170)
===================================================================
--- ansible/playbook.yml    2015-05-31 20:47:53 +0900 (d5742db)
+++ ansible/playbook.yml    2015-06-01 00:19:20 +0900 (986584e)
@@ -15,6 +15,7 @@
         - zsh
         - lv
         - acpid
+        - apg
     - name: Use VIM as the default editor
       command: update-alternatives --set editor /usr/bin/vim.basic
     - name: Use e-mail for apt-listchanges
@@ -132,143 +133,72 @@
         job: ~packages/bin/create-snapshot-package.sh
         user: packages
 
-    # # Droonga
-    # - name: Enable Groonga APT repository
-    #   apt_repository: repo=ppa:groonga/ppa
-    # - name: Install Droonga dependency libraries
-    #   apt: name={{ item }}
-    #   with_items:
-    #     - libgroonga-dev
-    #     - groonga-tokenizer-mecab
-    #     - groonga-bin
-    #     - ruby-dev
-    #     - nodejs
-    #     - nodejs-legacy
-    #     - npm
-    # - name: Create "droonga" group
-    #   group:
-    #     name=droonga
-
-    # # Droonga: droonga-engine
-    # - name: Create "droonga-engine" user
-    #   user:
-    #     name=droonga-engine
-    #     group=droonga
-    # - name: Create directories
-    #   file:
-    #     path=~droonga-engine/{{ item }}/
-    #     state=directory
-    #     owner=droonga-engine
-    #     group=droonga
-    #   with_items:
-    #     - droonga1
-    #     - droonga2
-    #     - droonga3
-    # - name: Put ~droonga-engine/.forward
-    #   copy:
-    #     content="packages �� groonga.org"
-    #     dest=~droonga-engine/.forward
-    #     owner=droonga-engine
-    #     group=droonga
-    # - name: Update droonga-engine repository
-    #   git:
-    #     repo=https://github.com/droonga/droonga-engine.git
-    #     dest=~droonga-engine/droonga-engine/
-    # - name: Install droonga-engine
-    #   shell: |-
-    #     rm -rf *.gem; \
-    #     gem build droonga-engine.gemspec && \
-    #     gem install droonga-engine-*.gem
-    #   args:
-    #     chdir: ~droonga-engine/droonga-engine
-    # - name: Configure droonga-engine
-    #   shell: sudo -u droonga-engine -H droonga-engine-catalog-generate --hosts=127.0.1.1,127.0.2.1,127.0.3.1 --output catalog.json
-    #   args:
-    #     chdir: ~droonga-engine/{{ item }}
-    #   with_items:
-    #     - droonga1
-    #     - droonga2
-    #     - droonga3
-    #   notify:
-    #     - Restart droonga-engine
-
-    # # Droonga: droonga-http-server
-    # - name: Create "droonga-http-server" user
-    #   user:
-    #     name=droonga-http-server
-    #     group=droonga
-    # - name: Create directories
-    #   file:
-    #     path=~droonga-http-server/droonga/
-    #     state=directory
-    #     owner=droonga-http-server
-    #     group=droonga
-    # - name: Put ~droonga-http-server/.forward
-    #   copy:
-    #     content="packages �� groonga.org"
-    #     dest=~droonga-http-server/.forward
-    #     owner=droonga-http-server
-    #     group=droonga
-    # - name: Install droonga-http-server
-    #   shell: |-
-    #     npm install -g \
-    #       express \
-    #       droonga/express-droonga \
-    #       droonga/droonga-http-server && \
-    #     rm -rf /usr/local/lib/node_modules/express-droonga/node_modules/express
-    # - name: Configure droonga-http-server
-    #   shell: |-
-    #     sudo -u droonga-http-server -H \
-    #       droonga-http-server-configure \
-    #         --quiet \
-    #         --droonga-engine-host-name 127.0.1.1 \
-    #         --receive-host-name 127.0.1.1
-    #   args:
-    #     chdir: ~droonga-http-server/droonga
-    #   notify:
-    #     - Restart droonga-http-server
+    # Groonga
+    - name: Enable Groonga APT repository
+      apt_repository: repo=ppa:groonga/ppa
+    - name: Install groonga-httpd
+      apt: name={{ item }}
+      with_items:
+        - groonga-bin
+        - groonga-httpd
+    - name: Put groonga-httpd configuration
+      copy:
+        src=files/groonga-httpd.conf
+        dest=/etc/groonga/httpd/groonga-httpd.conf
+      notify:
+        - Restart Groonga
 
-    # # 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 }}
-    #     state=latest
-    #     user_install=no
-    #   with_items:
-    #     - fluent-plugin-record-reformer
-    #     - fluent-plugin-groonga
-    #   notify:
-    #     - Restart Fluentd
-    # - 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
+    # 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 }}
+        state=latest
+        user_install=no
+      with_items:
+        - fluent-plugin-anonymizer
+        - fluent-plugin-groonga
+      notify:
+        - Restart Fluentd
+    - 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: Ensure salt for fluent-plugin-anonymizer
+      shell: apg -a 1 -n 1 -m 20 > /etc/td-agent/anonymizer-salt.txt
+      args:
+        creates: /etc/td-agent/anonymizer-salt.txt
+    - name: Set permission for salt file
+      file:
+        path=/etc/td-agent/anonymizer-salt.txt
+        mode=0600
+        owner=td-agent
+        group=td-agent
+    - name: Put fluentd.conf
+      copy:
+        src=files/fluentd/fluentd.conf
+        dest=/etc/td-agent/td-agent.conf
+      notify:
+        - Restart Fluentd
 
   handlers:
     - name: Restart Apache
@@ -277,39 +207,7 @@
       command: postalias /etc/aliases
     - name: Restart Postfix
       service: name=postfix state=restarted
-
-    - name: Restart droonga-engine
-      shell: |-
-        if [ -f droonga-engine.pid ]; then
-          sudo -u droonga-engine -H kill $(cat droonga-engine.pid)
-          sleep 3
-        fi
-        sudo -u droonga-engine -H \
-          droonga-engine \
-            --log-file droonga-engine.log \
-            --pid-file droonga-engine.pid \
-            --host 127.0.{{ item }}.1 \
-            --daemon
-      args:
-        chdir: ~droonga-engine/droonga{{ item }}
-      with_items:
-        - 1
-        - 2
-        - 3
-    - name: Restart droonga-http-server
-      shell: |-
-        if [ -f droonga-http-server.pid ]; then
-          sudo -u droonga-http-server -H kill $(cat droonga-http-server.pid)
-          sleep 3
-        fi
-        sudo -u droonga-http-server -H \
-          droonga-http-server \
-            --pid-file droonga-http-server.pid \
-            --enable-trust-proxy \
-            --host 127.0.1.1 \
-            --daemon
-      args:
-        chdir: ~droonga-http-server/droonga
-
+    - name: Restart Groonga
+      service: name=groonga-httpd state=restarted
     - name: Restart Fluentd
       service: name=td-agent state=restarted
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index