{"action":"created","comment":{"url":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/comments/62425439","id":62425439,"diff_hunk":"@@ -0,0 +1,141 @@\n+# The Fashion Logging System -- ELK - Part 2  \n+\n+\n+## 前言:  \n+繼[上一篇介紹什麼是 ELK ]後，這一篇我們將開始進入實作的部分，用 EC2 架設 Logstash 並搭配 AWS 提供的 Elasticsearch 與 Kibana 來架構 ELK，聽起來是不是有些小興奮呢  \n+首先我們會先講怎麼在 AWS 上開 ES 以及設定他，接著我們會講在 EC2 上安裝 Logstash 的步驟，最後會講怎麼樣從我們的 Logstash 送東西給 AWS 的 ES，並在 kibana 上看到那些資料  \n+\n+## 設定 AWS 的 Elasticsearch Service\n+首先盡到你的 AWS console，接著在所有服務的 Analytics 區塊裡可以看到 Elasticsearch Service，按下去之後你就會來到 ES 的  Dashboard 裡了！接著按 `Create a new domain` ，這個 domain 可以想像成是一個一個的 ES 資料庫，可以讓你來放跟不同類型的資料，進去創立 domain 的頁面後，先輸入你想要的 domain name，接著選擇符合你的使用量的 instance，接著設定 access policy，來決定這台 ES 可以讓誰 access，這邊我們為了方便，只設定兩個簡單的 rule，第一個是讓 Logstash 的 server 可以做 HTTP POST，這樣就可以新增資料，接著是讓所有人都可以對 ES 做 HTTP GET，讓大家都可以從 ES 裡獲取資訊，以下是 access policy範例：\n+```\n+{\n+  \"Version\": \"2012-10-17\",\n+  \"Statement\": [\n+    {\n+      \"Sid\": \"\",\n+      \"Effect\": \"Allow\",\n+      \"Principal\": {\n+        \"AWS\": \"*\"\n+      },\n+      \"Action\": \"es:ESHttpPost\",\n+      \"Resource\": \"arn:aws:es:ap-northeast-1:209570776318:domain/ichef/*\",\n+      \"Condition\": {\n+        \"IpAddress\": {\n+          \"aws:SourceIp\": \"<Logstash Server IP>\"\n+        }\n+      }\n+    },\n+    {\n+      \"Sid\": \"\",\n+      \"Effect\": \"Allow\",\n+      \"Principal\": {\n+        \"AWS\": \"*\"\n+      },\n+      \"Action\": \"es:ESHttpGet\",\n+      \"Resource\": \"arn:aws:es:ap-northeast-1:209570776318:domain/ichef/*\"\n+    }\n+  ]\n+}\n+```\n+更安全詳細的 access policy 設定可以參考 [AWS 的 access policy document]  \n+最後按下 `Confirm and create` 就完成開啟 ES 的任務了！\n+回到 Dashboard 後可以在側邊欄看到你新創立的 domain，點下去後就會開心地看到 Domain status 等等的相關資訊了，重點是那個 Endpoint，那是讓你的 Logstash 可以送資料進去的 url\n+\n+## 在 EC2 上架設 Logstash  \n+在開啟 ES 之後當然就是要來架設 Logstash 了，只要簡單的三步驟就可以完成囉！  \n+\n+### step 1: 開啟 EC2\n+基本上就是到你的 AWS EC2 Console 裡面，按 create instance 之後照著做就好了，唯一要記得的是 AMI 的部分記得選 ubuntu 或是 centos，選你自己的 AMI 也可以，不要用 windows 就好了！  \n+記得配一個 Elastic IP 給這台 EC2，因為我們上個步驟的 ES 有指定只有哪個 IP 的 server 可以送資料進去，然後要回 ES 的 access policy 裡面把 Logstash 這台 EC2 的 IP 加進去\n+然後 ssh 進到這台 EC2，準備進行接下來的步驟！\n+\n+### step 2: Install Logstash\n+首先要下載官網裡的 Logstash package\n+```\n+[root@logstash ~] wget https://download.elasticsearch.org/logstash/logstash/packages/centos/logstash-2.2.1.noarch.rpm\n+```\n+接著把它安裝起來\n+```\n+[root@logstash ~] yum install logstash-2.2.1.noarch.rpm\n+```\n+然後就完成了  \n+沒錯就是這麼簡單的讓我們進入第三步\n+\n+### step 3: Configuration and start\n+安裝完了之後呢，就是要按照我們上一篇所講的 Logstash 的設定方式來設定了，只要編輯下面的 .conf 檔即可\n+```\n+[root@logstash ~]  vi /etc/logstash/conf.d/logstash.conf\n+```\n+這個就是 Logstash 主要的設定檔了，把上次講的設定一古腦放進去就對了！\n+```","path":"_posts/2016-4-20-The Fashion Logging System -- ELK - Part 2.md","position":70,"original_position":70,"commit_id":"0278db6fcc670b96aef099385efea0c9ff6146bb","original_commit_id":"0278db6fcc670b96aef099385efea0c9ff6146bb","user":{"login":"oslo0322","id":5058547,"avatar_url":"https://avatars.githubusercontent.com/u/5058547?v=3","gravatar_id":"","url":"https://api.github.com/users/oslo0322","html_url":"https://github.com/oslo0322","followers_url":"https://api.github.com/users/oslo0322/followers","following_url":"https://api.github.com/users/oslo0322/following{/other_user}","gists_url":"https://api.github.com/users/oslo0322/gists{/gist_id}","starred_url":"https://api.github.com/users/oslo0322/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oslo0322/subscriptions","organizations_url":"https://api.github.com/users/oslo0322/orgs","repos_url":"https://api.github.com/users/oslo0322/repos","events_url":"https://api.github.com/users/oslo0322/events{/privacy}","received_events_url":"https://api.github.com/users/oslo0322/received_events","type":"User","site_admin":false},"body":"一古腦 -> 一股腦...","created_at":"2016-05-08T02:29:32Z","updated_at":"2016-05-08T02:29:32Z","html_url":"https://github.com/iCHEF/ichef.github.io/pull/3#discussion_r62425439","pull_request_url":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/comments/62425439"},"html":{"href":"https://github.com/iCHEF/ichef.github.io/pull/3#discussion_r62425439"},"pull_request":{"href":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/3","id":68110067,"html_url":"https://github.com/iCHEF/ichef.github.io/pull/3","diff_url":"https://github.com/iCHEF/ichef.github.io/pull/3.diff","patch_url":"https://github.com/iCHEF/ichef.github.io/pull/3.patch","issue_url":"https://api.github.com/repos/iCHEF/ichef.github.io/issues/3","number":3,"state":"open","locked":false,"title":"Alvin elk part2","user":{"login":"paizanmay","id":1533361,"avatar_url":"https://avatars.githubusercontent.com/u/1533361?v=3","gravatar_id":"","url":"https://api.github.com/users/paizanmay","html_url":"https://github.com/paizanmay","followers_url":"https://api.github.com/users/paizanmay/followers","following_url":"https://api.github.com/users/paizanmay/following{/other_user}","gists_url":"https://api.github.com/users/paizanmay/gists{/gist_id}","starred_url":"https://api.github.com/users/paizanmay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paizanmay/subscriptions","organizations_url":"https://api.github.com/users/paizanmay/orgs","repos_url":"https://api.github.com/users/paizanmay/repos","events_url":"https://api.github.com/users/paizanmay/events{/privacy}","received_events_url":"https://api.github.com/users/paizanmay/received_events","type":"User","site_admin":false},"body":"完成系列文第二篇了！\r\n文章請看 https://github.com/iCHEF/ichef.github.io/blob/Alvin_ELK_part2/_posts/2016-4-20-The%20Fashion%20Logging%20System%20--%20ELK%20-%20Part%202.md\r\n請大家不吝鞭打～有說明不清楚了內容就留言吧！","created_at":"2016-04-27T19:25:02Z","updated_at":"2016-05-08T02:29:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c04441855ff8dd97e5477585d35b5a368f69e595","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/3/commits","review_comments_url":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/3/comments","review_comment_url":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iCHEF/ichef.github.io/issues/3/comments","statuses_url":"https://api.github.com/repos/iCHEF/ichef.github.io/statuses/0278db6fcc670b96aef099385efea0c9ff6146bb","head":{"label":"iCHEF:Alvin_ELK_part2","ref":"Alvin_ELK_part2","sha":"0278db6fcc670b96aef099385efea0c9ff6146bb","user":{"login":"iCHEF","id":2927513,"avatar_url":"https://avatars.githubusercontent.com/u/2927513?v=3","gravatar_id":"","url":"https://api.github.com/users/iCHEF","html_url":"https://github.com/iCHEF","followers_url":"https://api.github.com/users/iCHEF/followers","following_url":"https://api.github.com/users/iCHEF/following{/other_user}","gists_url":"https://api.github.com/users/iCHEF/gists{/gist_id}","starred_url":"https://api.github.com/users/iCHEF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iCHEF/subscriptions","organizations_url":"https://api.github.com/users/iCHEF/orgs","repos_url":"https://api.github.com/users/iCHEF/repos","events_url":"https://api.github.com/users/iCHEF/events{/privacy}","received_events_url":"https://api.github.com/users/iCHEF/received_events","type":"Organization","site_admin":false},"repo":{"id":45096989,"name":"ichef.github.io","full_name":"iCHEF/ichef.github.io","owner":{"login":"iCHEF","id":2927513,"avatar_url":"https://avatars.githubusercontent.com/u/2927513?v=3","gravatar_id":"","url":"https://api.github.com/users/iCHEF","html_url":"https://github.com/iCHEF","followers_url":"https://api.github.com/users/iCHEF/followers","following_url":"https://api.github.com/users/iCHEF/following{/other_user}","gists_url":"https://api.github.com/users/iCHEF/gists{/gist_id}","starred_url":"https://api.github.com/users/iCHEF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iCHEF/subscriptions","organizations_url":"https://api.github.com/users/iCHEF/orgs","repos_url":"https://api.github.com/users/iCHEF/repos","events_url":"https://api.github.com/users/iCHEF/events{/privacy}","received_events_url":"https://api.github.com/users/iCHEF/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iCHEF/ichef.github.io","description":"Build a Jekyll blog in minutes, without touching the command line.","fork":true,"url":"https://api.github.com/repos/iCHEF/ichef.github.io","forks_url":"https://api.github.com/repos/iCHEF/ichef.github.io/forks","keys_url":"https://api.github.com/repos/iCHEF/ichef.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iCHEF/ichef.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iCHEF/ichef.github.io/teams","hooks_url":"https://api.github.com/repos/iCHEF/ichef.github.io/hooks","issue_events_url":"https://api.github.com/repos/iCHEF/ichef.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/iCHEF/ichef.github.io/events","assignees_url":"https://api.github.com/repos/iCHEF/ichef.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/iCHEF/ichef.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/iCHEF/ichef.github.io/tags","blobs_url":"https://api.github.com/repos/iCHEF/ichef.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iCHEF/ichef.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iCHEF/ichef.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/iCHEF/ichef.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iCHEF/ichef.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/iCHEF/ichef.github.io/languages","stargazers_url":"https://api.github.com/repos/iCHEF/ichef.github.io/stargazers","contributors_url":"https://api.github.com/repos/iCHEF/ichef.github.io/contributors","subscribers_url":"https://api.github.com/repos/iCHEF/ichef.github.io/subscribers","subscription_url":"https://api.github.com/repos/iCHEF/ichef.github.io/subscription","commits_url":"https://api.github.com/repos/iCHEF/ichef.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/iCHEF/ichef.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/iCHEF/ichef.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/iCHEF/ichef.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/iCHEF/ichef.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/iCHEF/ichef.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iCHEF/ichef.github.io/merges","archive_url":"https://api.github.com/repos/iCHEF/ichef.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iCHEF/ichef.github.io/downloads","issues_url":"https://api.github.com/repos/iCHEF/ichef.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/iCHEF/ichef.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/iCHEF/ichef.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iCHEF/ichef.github.io/labels{/name}","releases_url":"https://api.github.com/repos/iCHEF/ichef.github.io/releases{/id}","deployments_url":"https://api.github.com/repos/iCHEF/ichef.github.io/deployments","created_at":"2015-10-28T07:53:18Z","updated_at":"2016-02-05T09:16:59Z","pushed_at":"2016-04-27T19:25:03Z","git_url":"git://github.com/iCHEF/ichef.github.io.git","ssh_url":"git@github.com:iCHEF/ichef.github.io.git","clone_url":"https://github.com/iCHEF/ichef.github.io.git","svn_url":"https://github.com/iCHEF/ichef.github.io","homepage":"","size":9441,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"iCHEF:master","ref":"master","sha":"2e63fd65cc426a4119ba17ed1744c20c929db811","user":{"login":"iCHEF","id":2927513,"avatar_url":"https://avatars.githubusercontent.com/u/2927513?v=3","gravatar_id":"","url":"https://api.github.com/users/iCHEF","html_url":"https://github.com/iCHEF","followers_url":"https://api.github.com/users/iCHEF/followers","following_url":"https://api.github.com/users/iCHEF/following{/other_user}","gists_url":"https://api.github.com/users/iCHEF/gists{/gist_id}","starred_url":"https://api.github.com/users/iCHEF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iCHEF/subscriptions","organizations_url":"https://api.github.com/users/iCHEF/orgs","repos_url":"https://api.github.com/users/iCHEF/repos","events_url":"https://api.github.com/users/iCHEF/events{/privacy}","received_events_url":"https://api.github.com/users/iCHEF/received_events","type":"Organization","site_admin":false},"repo":{"id":45096989,"name":"ichef.github.io","full_name":"iCHEF/ichef.github.io","owner":{"login":"iCHEF","id":2927513,"avatar_url":"https://avatars.githubusercontent.com/u/2927513?v=3","gravatar_id":"","url":"https://api.github.com/users/iCHEF","html_url":"https://github.com/iCHEF","followers_url":"https://api.github.com/users/iCHEF/followers","following_url":"https://api.github.com/users/iCHEF/following{/other_user}","gists_url":"https://api.github.com/users/iCHEF/gists{/gist_id}","starred_url":"https://api.github.com/users/iCHEF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iCHEF/subscriptions","organizations_url":"https://api.github.com/users/iCHEF/orgs","repos_url":"https://api.github.com/users/iCHEF/repos","events_url":"https://api.github.com/users/iCHEF/events{/privacy}","received_events_url":"https://api.github.com/users/iCHEF/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iCHEF/ichef.github.io","description":"Build a Jekyll blog in minutes, without touching the command line.","fork":true,"url":"https://api.github.com/repos/iCHEF/ichef.github.io","forks_url":"https://api.github.com/repos/iCHEF/ichef.github.io/forks","keys_url":"https://api.github.com/repos/iCHEF/ichef.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iCHEF/ichef.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iCHEF/ichef.github.io/teams","hooks_url":"https://api.github.com/repos/iCHEF/ichef.github.io/hooks","issue_events_url":"https://api.github.com/repos/iCHEF/ichef.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/iCHEF/ichef.github.io/events","assignees_url":"https://api.github.com/repos/iCHEF/ichef.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/iCHEF/ichef.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/iCHEF/ichef.github.io/tags","blobs_url":"https://api.github.com/repos/iCHEF/ichef.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iCHEF/ichef.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iCHEF/ichef.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/iCHEF/ichef.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iCHEF/ichef.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/iCHEF/ichef.github.io/languages","stargazers_url":"https://api.github.com/repos/iCHEF/ichef.github.io/stargazers","contributors_url":"https://api.github.com/repos/iCHEF/ichef.github.io/contributors","subscribers_url":"https://api.github.com/repos/iCHEF/ichef.github.io/subscribers","subscription_url":"https://api.github.com/repos/iCHEF/ichef.github.io/subscription","commits_url":"https://api.github.com/repos/iCHEF/ichef.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/iCHEF/ichef.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/iCHEF/ichef.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/iCHEF/ichef.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/iCHEF/ichef.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/iCHEF/ichef.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iCHEF/ichef.github.io/merges","archive_url":"https://api.github.com/repos/iCHEF/ichef.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iCHEF/ichef.github.io/downloads","issues_url":"https://api.github.com/repos/iCHEF/ichef.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/iCHEF/ichef.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/iCHEF/ichef.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iCHEF/ichef.github.io/labels{/name}","releases_url":"https://api.github.com/repos/iCHEF/ichef.github.io/releases{/id}","deployments_url":"https://api.github.com/repos/iCHEF/ichef.github.io/deployments","created_at":"2015-10-28T07:53:18Z","updated_at":"2016-02-05T09:16:59Z","pushed_at":"2016-04-27T19:25:03Z","git_url":"git://github.com/iCHEF/ichef.github.io.git","ssh_url":"git@github.com:iCHEF/ichef.github.io.git","clone_url":"https://github.com/iCHEF/ichef.github.io.git","svn_url":"https://github.com/iCHEF/ichef.github.io","homepage":"","size":9441,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/3"},"html":{"href":"https://github.com/iCHEF/ichef.github.io/pull/3"},"issue":{"href":"https://api.github.com/repos/iCHEF/ichef.github.io/issues/3"},"comments":{"href":"https://api.github.com/repos/iCHEF/ichef.github.io/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iCHEF/ichef.github.io/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/iCHEF/ichef.github.io/statuses/0278db6fcc670b96aef099385efea0c9ff6146bb"}}}}