{"action":"created","comment":{"url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/comments/36690863","id":36690863,"diff_hunk":"@@ -0,0 +1,66 @@\n+# encoding: utf-8\n+require \"logstash/devutils/rspec/spec_helper\"\n+require \"logstash/filters/mutate\"\n+\n+# running mutate which depends on grok  outside a logstash package means\n+# LOGSTASH_HOME will not be defined, so let's set it here\n+# before requiring the grok filter\n+unless LogStash::Environment.const_defined?(:LOGSTASH_HOME)\n+  LogStash::Environment::LOGSTASH_HOME = File.expand_path(\"../../../\", __FILE__)\n+end\n+\n+describe LogStash::Filters::Mutate do\n+  let(:pipeline) { LogStash::Pipeline.new(config) }\n+  let(:events) do\n+    arr = event.is_a?(Array) ? event : [event]\n+    arr.map do |evt|\n+      LogStash::Event.new(evt.is_a?(String) ? LogStash::Json.load(evt) : evt)\n+    end\n+  end\n+\n+  let(:results) do\n+    pipeline.instance_eval { @filters.each(&:register) }\n+    results  = []\n+    events.each do |evt|\n+      # filter call the block on all filtered events, included new events added by the filter\n+      pipeline.filter(evt) do |filtered_event|\n+        results.push(filtered_event)\n+      end\n+    end\n+    pipeline.flush_filters(:final => true) { |flushed_event| results << flushed_event }\n+\n+    results.select { |e| !e.cancelled? }\n+  end\n+\n+  describe 'MUTATE-33: multi stage with json, grok and mutate, Case mutation' do\n+    let(:event) do\n+      \"{\\\"message\\\":\\\"hello WORLD\\\",\\\"examplefield\\\":\\\"PPQQRRSS\\\"}\"\n+    end\n+\n+    let(:config) do\n+      <<-CONFIG\n+filter {\n+    grok {\n+        match => { \"message\" => \"(?:hello|world) %{WORD:bar}\" }","path":"spec/filters/integration/multi_stage_spec.rb","position":44,"original_position":44,"commit_id":"9922c2160dcae50eb4fadc8a1dd1073ccece5a58","original_commit_id":"9922c2160dcae50eb4fadc8a1dd1073ccece5a58","user":{"login":"jordansissel","id":131818,"avatar_url":"https://avatars.githubusercontent.com/u/131818?v=3","gravatar_id":"","url":"https://api.github.com/users/jordansissel","html_url":"https://github.com/jordansissel","followers_url":"https://api.github.com/users/jordansissel/followers","following_url":"https://api.github.com/users/jordansissel/following{/other_user}","gists_url":"https://api.github.com/users/jordansissel/gists{/gist_id}","starred_url":"https://api.github.com/users/jordansissel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordansissel/subscriptions","organizations_url":"https://api.github.com/users/jordansissel/orgs","repos_url":"https://api.github.com/users/jordansissel/repos","events_url":"https://api.github.com/users/jordansissel/events{/privacy}","received_events_url":"https://api.github.com/users/jordansissel/received_events","type":"User","site_admin":false},"body":"Is grok necessary to do this test?\r\n\r\nAlso, matching `(?:hello|world)` reads a bit funny since your sample only could match `hello` - what is the goal of having the branch to `world` ?","created_at":"2015-08-10T22:08:09Z","updated_at":"2015-08-10T22:08:09Z","html_url":"https://github.com/logstash-plugins/logstash-filter-mutate/pull/42#discussion_r36690863","pull_request_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/comments/36690863"},"html":{"href":"https://github.com/logstash-plugins/logstash-filter-mutate/pull/42#discussion_r36690863"},"pull_request":{"href":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/42","id":42066193,"html_url":"https://github.com/logstash-plugins/logstash-filter-mutate/pull/42","diff_url":"https://github.com/logstash-plugins/logstash-filter-mutate/pull/42.diff","patch_url":"https://github.com/logstash-plugins/logstash-filter-mutate/pull/42.patch","issue_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/issues/42","number":42,"state":"open","locked":false,"title":"Issue 33 - Fix for the downcase and upcase malfunction","user":{"login":"guyboertje","id":84912,"avatar_url":"https://avatars.githubusercontent.com/u/84912?v=3","gravatar_id":"","url":"https://api.github.com/users/guyboertje","html_url":"https://github.com/guyboertje","followers_url":"https://api.github.com/users/guyboertje/followers","following_url":"https://api.github.com/users/guyboertje/following{/other_user}","gists_url":"https://api.github.com/users/guyboertje/gists{/gist_id}","starred_url":"https://api.github.com/users/guyboertje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guyboertje/subscriptions","organizations_url":"https://api.github.com/users/guyboertje/orgs","repos_url":"https://api.github.com/users/guyboertje/repos","events_url":"https://api.github.com/users/guyboertje/events{/privacy}","received_events_url":"https://api.github.com/users/guyboertje/received_events","type":"User","site_admin":false},"body":"Refactored the other methods to the same pattern.\r\nAdded a specific multi-stage test\r\n\r\nLet me know if the test group addition to the Gemfile is not OK\r\nBy putting this section in there one can use the path: <local repo> option for debugging\r\n","created_at":"2015-08-10T21:05:23Z","updated_at":"2015-08-10T22:08:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce3bca8da8eb79ca82af0cc8622672d777d98bd5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/42/commits","review_comments_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/42/comments","review_comment_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/issues/42/comments","statuses_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/statuses/9922c2160dcae50eb4fadc8a1dd1073ccece5a58","head":{"label":"guyboertje:issues/GH-33","ref":"issues/GH-33","sha":"9922c2160dcae50eb4fadc8a1dd1073ccece5a58","user":{"login":"guyboertje","id":84912,"avatar_url":"https://avatars.githubusercontent.com/u/84912?v=3","gravatar_id":"","url":"https://api.github.com/users/guyboertje","html_url":"https://github.com/guyboertje","followers_url":"https://api.github.com/users/guyboertje/followers","following_url":"https://api.github.com/users/guyboertje/following{/other_user}","gists_url":"https://api.github.com/users/guyboertje/gists{/gist_id}","starred_url":"https://api.github.com/users/guyboertje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guyboertje/subscriptions","organizations_url":"https://api.github.com/users/guyboertje/orgs","repos_url":"https://api.github.com/users/guyboertje/repos","events_url":"https://api.github.com/users/guyboertje/events{/privacy}","received_events_url":"https://api.github.com/users/guyboertje/received_events","type":"User","site_admin":false},"repo":{"id":40166772,"name":"logstash-filter-mutate","full_name":"guyboertje/logstash-filter-mutate","owner":{"login":"guyboertje","id":84912,"avatar_url":"https://avatars.githubusercontent.com/u/84912?v=3","gravatar_id":"","url":"https://api.github.com/users/guyboertje","html_url":"https://github.com/guyboertje","followers_url":"https://api.github.com/users/guyboertje/followers","following_url":"https://api.github.com/users/guyboertje/following{/other_user}","gists_url":"https://api.github.com/users/guyboertje/gists{/gist_id}","starred_url":"https://api.github.com/users/guyboertje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guyboertje/subscriptions","organizations_url":"https://api.github.com/users/guyboertje/orgs","repos_url":"https://api.github.com/users/guyboertje/repos","events_url":"https://api.github.com/users/guyboertje/events{/privacy}","received_events_url":"https://api.github.com/users/guyboertje/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/guyboertje/logstash-filter-mutate","description":null,"fork":true,"url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate","forks_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/forks","keys_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/teams","hooks_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/hooks","issue_events_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/issues/events{/number}","events_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/events","assignees_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/assignees{/user}","branches_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/branches{/branch}","tags_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/tags","blobs_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/git/refs{/sha}","trees_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/statuses/{sha}","languages_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/languages","stargazers_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/stargazers","contributors_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/contributors","subscribers_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/subscribers","subscription_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/subscription","commits_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/commits{/sha}","git_commits_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/git/commits{/sha}","comments_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/comments{/number}","issue_comment_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/issues/comments{/number}","contents_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/contents/{+path}","compare_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/merges","archive_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/downloads","issues_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/issues{/number}","pulls_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/pulls{/number}","milestones_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/milestones{/number}","notifications_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/labels{/name}","releases_url":"https://api.github.com/repos/guyboertje/logstash-filter-mutate/releases{/id}","created_at":"2015-08-04T06:14:36Z","updated_at":"2015-08-04T06:14:36Z","pushed_at":"2015-08-10T21:01:12Z","git_url":"git://github.com/guyboertje/logstash-filter-mutate.git","ssh_url":"git@github.com:guyboertje/logstash-filter-mutate.git","clone_url":"https://github.com/guyboertje/logstash-filter-mutate.git","svn_url":"https://github.com/guyboertje/logstash-filter-mutate","homepage":null,"size":117,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"logstash-plugins:master","ref":"master","sha":"e49dd6a89655501be56c35df29eb2d913b065074","user":{"login":"logstash-plugins","id":8961934,"avatar_url":"https://avatars.githubusercontent.com/u/8961934?v=3","gravatar_id":"","url":"https://api.github.com/users/logstash-plugins","html_url":"https://github.com/logstash-plugins","followers_url":"https://api.github.com/users/logstash-plugins/followers","following_url":"https://api.github.com/users/logstash-plugins/following{/other_user}","gists_url":"https://api.github.com/users/logstash-plugins/gists{/gist_id}","starred_url":"https://api.github.com/users/logstash-plugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/logstash-plugins/subscriptions","organizations_url":"https://api.github.com/users/logstash-plugins/orgs","repos_url":"https://api.github.com/users/logstash-plugins/repos","events_url":"https://api.github.com/users/logstash-plugins/events{/privacy}","received_events_url":"https://api.github.com/users/logstash-plugins/received_events","type":"Organization","site_admin":false},"repo":{"id":24894914,"name":"logstash-filter-mutate","full_name":"logstash-plugins/logstash-filter-mutate","owner":{"login":"logstash-plugins","id":8961934,"avatar_url":"https://avatars.githubusercontent.com/u/8961934?v=3","gravatar_id":"","url":"https://api.github.com/users/logstash-plugins","html_url":"https://github.com/logstash-plugins","followers_url":"https://api.github.com/users/logstash-plugins/followers","following_url":"https://api.github.com/users/logstash-plugins/following{/other_user}","gists_url":"https://api.github.com/users/logstash-plugins/gists{/gist_id}","starred_url":"https://api.github.com/users/logstash-plugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/logstash-plugins/subscriptions","organizations_url":"https://api.github.com/users/logstash-plugins/orgs","repos_url":"https://api.github.com/users/logstash-plugins/repos","events_url":"https://api.github.com/users/logstash-plugins/events{/privacy}","received_events_url":"https://api.github.com/users/logstash-plugins/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/logstash-plugins/logstash-filter-mutate","description":null,"fork":false,"url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate","forks_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/forks","keys_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/teams","hooks_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/hooks","issue_events_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/issues/events{/number}","events_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/events","assignees_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/assignees{/user}","branches_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/branches{/branch}","tags_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/tags","blobs_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/git/refs{/sha}","trees_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/statuses/{sha}","languages_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/languages","stargazers_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/stargazers","contributors_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/contributors","subscribers_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/subscribers","subscription_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/subscription","commits_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/commits{/sha}","git_commits_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/git/commits{/sha}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/comments{/number}","issue_comment_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/issues/comments{/number}","contents_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/contents/{+path}","compare_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/merges","archive_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/downloads","issues_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/issues{/number}","pulls_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls{/number}","milestones_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/milestones{/number}","notifications_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/labels{/name}","releases_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/releases{/id}","created_at":"2014-10-07T14:46:56Z","updated_at":"2015-08-04T09:13:09Z","pushed_at":"2015-08-10T21:05:24Z","git_url":"git://github.com/logstash-plugins/logstash-filter-mutate.git","ssh_url":"git@github.com:logstash-plugins/logstash-filter-mutate.git","clone_url":"https://github.com/logstash-plugins/logstash-filter-mutate.git","svn_url":"https://github.com/logstash-plugins/logstash-filter-mutate","homepage":null,"size":397,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":25,"forks":20,"open_issues":25,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/42"},"html":{"href":"https://github.com/logstash-plugins/logstash-filter-mutate/pull/42"},"issue":{"href":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/issues/42"},"comments":{"href":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/logstash-plugins/logstash-filter-mutate/statuses/9922c2160dcae50eb4fadc8a1dd1073ccece5a58"}}}}