fluent-plugin-filter-parse-postfix 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +55 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fluent-plugin-filter-parse-postfix.gemspec +30 -0
- data/lib/fluent/plugin/filter_parse_postfix.rb +36 -0
- data/lib/fluent_plugin_filter_parse_postfix/version.rb +3 -0
- metadata +154 -0
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: 7b9f410e91649436452fea88938e5ec0b70ff1be
         | 
| 4 | 
            +
              data.tar.gz: f97903a9b110ce6e4f865dcb3198e2643a99499d
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: 291b2c28b878c054fdee7bea9ade41a6cf1eee8bae57b6eaa54a01a26638ae7bf243978f12cf96805c0a46963853b603f064ebf39db6c78669824fc01a32b246
         | 
| 7 | 
            +
              data.tar.gz: 10b6a37b17edbe0842e922b65fc4e88cff11b59f481928fe65c41ca724267eea1fad5a137b69505d56c294aa0aa741a9ac223e2d85ac02ac741597706ea19bfc
         | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.rspec
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            The MIT License (MIT)
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Copyright (c) 2015 Genki Sugawara
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 6 | 
            +
            of this software and associated documentation files (the "Software"), to deal
         | 
| 7 | 
            +
            in the Software without restriction, including without limitation the rights
         | 
| 8 | 
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 9 | 
            +
            copies of the Software, and to permit persons to whom the Software is
         | 
| 10 | 
            +
            furnished to do so, subject to the following conditions:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            The above copyright notice and this permission notice shall be included in
         | 
| 13 | 
            +
            all copies or substantial portions of the Software.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 16 | 
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 17 | 
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 18 | 
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 19 | 
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 20 | 
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 21 | 
            +
            THE SOFTWARE.
         | 
    
        data/README.md
    ADDED
    
    | @@ -0,0 +1,55 @@ | |
| 1 | 
            +
            # fluent-plugin-filter-parse-postfix
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Filter Plugin to parse Postfix status line log.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            [](https://travis-ci.org/winebarrel/fluent-plugin-filter-parse-postfix)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ## Installation
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            Add this line to your application's Gemfile:
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ```ruby
         | 
| 12 | 
            +
            gem 'fluent-plugin-filter-parse-postfix'
         | 
| 13 | 
            +
            ```
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            And then execute:
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                $ bundle
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            Or install it yourself as:
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                $ gem install fluent-plugin-filter-parse-postfix
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            ## Configuration
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            ```apache
         | 
| 26 | 
            +
            <filter>
         | 
| 27 | 
            +
              type postfix_status_line
         | 
| 28 | 
            +
              #key message
         | 
| 29 | 
            +
              #mask true
         | 
| 30 | 
            +
            </filter>
         | 
| 31 | 
            +
            ```
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            ## Usage
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            ```sh
         | 
| 36 | 
            +
            $ cat fluent.conf
         | 
| 37 | 
            +
            <source>
         | 
| 38 | 
            +
              @type forward
         | 
| 39 | 
            +
            </source>
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            <filter>
         | 
| 42 | 
            +
              @type parse_postfix
         | 
| 43 | 
            +
            </filter>
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            <match **>
         | 
| 46 | 
            +
              @type stdout
         | 
| 47 | 
            +
            </match>
         | 
| 48 | 
            +
             | 
| 49 | 
            +
            $ fluentd -c fluent.conf
         | 
| 50 | 
            +
            ```
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            ```sh
         | 
| 53 | 
            +
            $ echo '{"message":"Feb 27 09:02:38 MyHOSTNAME postfix/smtp[26490]: 5E31727A35D: to=<bellsouth@myemail.net>, relay=gateway-f1.isp.att.net[204.127.217.17]:25, delay=0.58, delays=0.11/0.03/0.23/0.20, dsn=2.0.0, status=sent (250 ok ; id=en4req0070M63004172202102)"}' | fluent-cat test.test
         | 
| 54 | 
            +
            #=> 2015-12-22 02:02:22 +0900 test.test: {"time":"Feb 27 09:02:38","hostname":"MyHOSTNAME","process":"postfix/smtp[26490]","queue_id":"5E31727A35D","to":"<*********@myemail.net>","relay":"gateway-f1.isp.att.net[204.127.217.17]:25","delay":0.58,"delays":"0.11/0.03/0.23/0.20","dsn":"2.0.0","status":"sent (250 ok ; id=en4req0070M63004172202102)"}
         | 
| 55 | 
            +
            ```
         | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/console
    ADDED
    
    | @@ -0,0 +1,14 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "bundler/setup"
         | 
| 4 | 
            +
            require "fluent/plugin/filter/parse/postfix"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            # You can add fixtures and/or initialization code here to make experimenting
         | 
| 7 | 
            +
            # with your gem easier. You can also use a different console, if you like.
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         | 
| 10 | 
            +
            # require "pry"
         | 
| 11 | 
            +
            # Pry.start
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            require "irb"
         | 
| 14 | 
            +
            IRB.start
         | 
    
        data/bin/setup
    ADDED
    
    
| @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            # coding: utf-8
         | 
| 2 | 
            +
            lib = File.expand_path('../lib', __FILE__)
         | 
| 3 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            +
            require 'fluent_plugin_filter_parse_postfix/version'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |spec|
         | 
| 7 | 
            +
              spec.name          = 'fluent-plugin-filter-parse-postfix'
         | 
| 8 | 
            +
              spec.version       = FluentPluginFilterParsePostfix::VERSION
         | 
| 9 | 
            +
              spec.authors       = ['Genki Sugawara']
         | 
| 10 | 
            +
              spec.email         = ['sugawara@cookpad.com']
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              spec.summary       = %q{Filter Plugin to parse Postfix status line log.}
         | 
| 13 | 
            +
              spec.description   = %q{Filter Plugin to parse Postfix status line log.}
         | 
| 14 | 
            +
              spec.homepage      = 'https://github.com/winebarrel/fluent-plugin-filter-parse-postfix'
         | 
| 15 | 
            +
              spec.license       = 'MIT'
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         | 
| 18 | 
            +
              spec.bindir        = 'exe'
         | 
| 19 | 
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         | 
| 20 | 
            +
              spec.require_paths = ['lib']
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              spec.add_dependency 'fluentd', '>= 0.12'
         | 
| 23 | 
            +
              spec.add_dependency 'postfix_status_line'
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              spec.add_development_dependency 'bundler'
         | 
| 26 | 
            +
              spec.add_development_dependency 'rake'
         | 
| 27 | 
            +
              spec.add_development_dependency 'rspec', '>= 3.0.0'
         | 
| 28 | 
            +
              spec.add_development_dependency 'test-unit', '>= 3.1.0'
         | 
| 29 | 
            +
              spec.add_development_dependency 'timecop'
         | 
| 30 | 
            +
            end
         | 
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            require 'fluent_plugin_filter_parse_postfix/version'
         | 
| 2 | 
            +
            require 'postfix_status_line'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Fluent
         | 
| 5 | 
            +
              class ParsePostfixFilter < Filter
         | 
| 6 | 
            +
                Plugin.register_filter('parse_postfix', self)
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                config_param :key,  :string, :default => 'message'
         | 
| 9 | 
            +
                config_param :mask, :bool,   :default => true
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def filter_stream(tag, es)
         | 
| 12 | 
            +
                  result_es = Fluent::MultiEventStream.new
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  es.each do |time, record|
         | 
| 15 | 
            +
                    parse_postfix(time, record, result_es)
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  result_es
         | 
| 19 | 
            +
                rescue => e
         | 
| 20 | 
            +
                  log.warn e.message
         | 
| 21 | 
            +
                  log.warn e.backtrace.join(', ')
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                private
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                def parse_postfix(time, record, result_es)
         | 
| 27 | 
            +
                  line = record[@key]
         | 
| 28 | 
            +
                  return unless line
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                  line = PostfixStatusLine.parse(line, @mask)
         | 
| 31 | 
            +
                  return unless line
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  result_es.add(time, line)
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,154 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: fluent-plugin-filter-parse-postfix
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.1.0
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Genki Sugawara
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: exe
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2015-12-21 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: fluentd
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - '>='
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '0.12'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - '>='
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '0.12'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: postfix_status_line
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - '>='
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '0'
         | 
| 34 | 
            +
              type: :runtime
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - '>='
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '0'
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: bundler
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - '>='
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '0'
         | 
| 48 | 
            +
              type: :development
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - '>='
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '0'
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: rake
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - '>='
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
              type: :development
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - '>='
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: '0'
         | 
| 69 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            +
              name: rspec
         | 
| 71 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
                requirements:
         | 
| 73 | 
            +
                - - '>='
         | 
| 74 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            +
                    version: 3.0.0
         | 
| 76 | 
            +
              type: :development
         | 
| 77 | 
            +
              prerelease: false
         | 
| 78 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 | 
            +
                requirements:
         | 
| 80 | 
            +
                - - '>='
         | 
| 81 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            +
                    version: 3.0.0
         | 
| 83 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 84 | 
            +
              name: test-unit
         | 
| 85 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 | 
            +
                requirements:
         | 
| 87 | 
            +
                - - '>='
         | 
| 88 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            +
                    version: 3.1.0
         | 
| 90 | 
            +
              type: :development
         | 
| 91 | 
            +
              prerelease: false
         | 
| 92 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 | 
            +
                requirements:
         | 
| 94 | 
            +
                - - '>='
         | 
| 95 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 96 | 
            +
                    version: 3.1.0
         | 
| 97 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 98 | 
            +
              name: timecop
         | 
| 99 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 | 
            +
                requirements:
         | 
| 101 | 
            +
                - - '>='
         | 
| 102 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            +
                    version: '0'
         | 
| 104 | 
            +
              type: :development
         | 
| 105 | 
            +
              prerelease: false
         | 
| 106 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 | 
            +
                requirements:
         | 
| 108 | 
            +
                - - '>='
         | 
| 109 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            +
                    version: '0'
         | 
| 111 | 
            +
            description: Filter Plugin to parse Postfix status line log.
         | 
| 112 | 
            +
            email:
         | 
| 113 | 
            +
            - sugawara@cookpad.com
         | 
| 114 | 
            +
            executables: []
         | 
| 115 | 
            +
            extensions: []
         | 
| 116 | 
            +
            extra_rdoc_files: []
         | 
| 117 | 
            +
            files:
         | 
| 118 | 
            +
            - .gitignore
         | 
| 119 | 
            +
            - .rspec
         | 
| 120 | 
            +
            - .travis.yml
         | 
| 121 | 
            +
            - Gemfile
         | 
| 122 | 
            +
            - LICENSE.txt
         | 
| 123 | 
            +
            - README.md
         | 
| 124 | 
            +
            - Rakefile
         | 
| 125 | 
            +
            - bin/console
         | 
| 126 | 
            +
            - bin/setup
         | 
| 127 | 
            +
            - fluent-plugin-filter-parse-postfix.gemspec
         | 
| 128 | 
            +
            - lib/fluent/plugin/filter_parse_postfix.rb
         | 
| 129 | 
            +
            - lib/fluent_plugin_filter_parse_postfix/version.rb
         | 
| 130 | 
            +
            homepage: https://github.com/winebarrel/fluent-plugin-filter-parse-postfix
         | 
| 131 | 
            +
            licenses:
         | 
| 132 | 
            +
            - MIT
         | 
| 133 | 
            +
            metadata: {}
         | 
| 134 | 
            +
            post_install_message: 
         | 
| 135 | 
            +
            rdoc_options: []
         | 
| 136 | 
            +
            require_paths:
         | 
| 137 | 
            +
            - lib
         | 
| 138 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 139 | 
            +
              requirements:
         | 
| 140 | 
            +
              - - '>='
         | 
| 141 | 
            +
                - !ruby/object:Gem::Version
         | 
| 142 | 
            +
                  version: '0'
         | 
| 143 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 144 | 
            +
              requirements:
         | 
| 145 | 
            +
              - - '>='
         | 
| 146 | 
            +
                - !ruby/object:Gem::Version
         | 
| 147 | 
            +
                  version: '0'
         | 
| 148 | 
            +
            requirements: []
         | 
| 149 | 
            +
            rubyforge_project: 
         | 
| 150 | 
            +
            rubygems_version: 2.0.14.1
         | 
| 151 | 
            +
            signing_key: 
         | 
| 152 | 
            +
            specification_version: 4
         | 
| 153 | 
            +
            summary: Filter Plugin to parse Postfix status line log.
         | 
| 154 | 
            +
            test_files: []
         |