fluent-plugin-logtail 0.1.1 → 0.2.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 +4 -4
 - data/fluent-plugin-logtail.gemspec +1 -1
 - data/lib/fluent/plugin/out_logtail.rb +9 -2
 - data/spec/fluent/plugin/out_logtail_spec.rb +2 -2
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5cd27c41c2106c4ad4a4ca994b6629de4c8cc11993a09d86a0448f9e593d8bae
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7246466098b9ef5e9596294448288d3e7f7ba4603b7c3b4710925e07421a9375
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 39db77c91bd5f4a9df55c9200c616c5eacf8eb65a62a11fdeea46ac821dd6175002cffe728c040b00cfc771f7f078d8e0ccdd581283dab3a5534b1be881faf1f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e10e9a21edbac7ffc34f1d0f6c750993adabbc357dc3d8288cd12752fb300ecd30eff3710588e64ffab9e335a5600a5fc7dce42ed0a02a204dfeb1824cd2100f
         
     | 
| 
         @@ -3,7 +3,7 @@ require 'date' 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       5 
5 
     | 
    
         
             
              s.name        = 'fluent-plugin-logtail'
         
     | 
| 
       6 
     | 
    
         
            -
              s.version     = '0. 
     | 
| 
      
 6 
     | 
    
         
            +
              s.version     = '0.2.0'
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.date        = Date.today.to_s
         
     | 
| 
       8 
8 
     | 
    
         
             
              s.summary     = 'Logtail.com plugin for Fluentd'
         
     | 
| 
       9 
9 
     | 
    
         
             
              s.description = 'Streams Fluentd logs to the Logtail.com logging service.'
         
     | 
| 
         @@ -5,7 +5,7 @@ module Fluent 
     | 
|
| 
       5 
5 
     | 
    
         
             
              class LogtailOutput < Fluent::BufferedOutput
         
     | 
| 
       6 
6 
     | 
    
         
             
                Fluent::Plugin.register_output('logtail', self)
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
                VERSION = "0. 
     | 
| 
      
 8 
     | 
    
         
            +
                VERSION = "0.2.0".freeze
         
     | 
| 
       9 
9 
     | 
    
         
             
                CONTENT_TYPE = "application/msgpack".freeze
         
     | 
| 
       10 
10 
     | 
    
         
             
                HOST = "in.logtail.com".freeze
         
     | 
| 
       11 
11 
     | 
    
         
             
                PORT = 443
         
     | 
| 
         @@ -38,11 +38,17 @@ module Fluent 
     | 
|
| 
       38 
38 
     | 
    
         
             
                    end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                    http = build_http_client
         
     | 
| 
       41 
     | 
    
         
            -
                     
     | 
| 
      
 41 
     | 
    
         
            +
                    records=0
         
     | 
| 
      
 42 
     | 
    
         
            +
                    chunk.each do
         
     | 
| 
      
 43 
     | 
    
         
            +
                      records=records+1
         
     | 
| 
      
 44 
     | 
    
         
            +
                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
                    body = [0xdd,records].pack("CN")
         
     | 
| 
      
 46 
     | 
    
         
            +
                    body << chunk.read
         
     | 
| 
       42 
47 
     | 
    
         | 
| 
       43 
48 
     | 
    
         
             
                    begin
         
     | 
| 
       44 
49 
     | 
    
         
             
                      resp = http.start do |conn|
         
     | 
| 
       45 
50 
     | 
    
         
             
                        req = build_request(body)
         
     | 
| 
      
 51 
     | 
    
         
            +
                        log.debug("sending #{req.body.length} bytes to logtail")
         
     | 
| 
       46 
52 
     | 
    
         
             
                        conn.request(req)
         
     | 
| 
       47 
53 
     | 
    
         
             
                      end
         
     | 
| 
       48 
54 
     | 
    
         
             
                    ensure
         
     | 
| 
         @@ -51,6 +57,7 @@ module Fluent 
     | 
|
| 
       51 
57 
     | 
    
         | 
| 
       52 
58 
     | 
    
         
             
                    code = resp.code.to_i
         
     | 
| 
       53 
59 
     | 
    
         
             
                    if code >= 200 && code <= 299
         
     | 
| 
      
 60 
     | 
    
         
            +
                      log.debug "POST request to logtail was responded to with status code #{code}"
         
     | 
| 
       54 
61 
     | 
    
         
             
                      true
         
     | 
| 
       55 
62 
     | 
    
         
             
                    elsif RETRYABLE_CODES.include?(code)
         
     | 
| 
       56 
63 
     | 
    
         
             
                      sleep_time = sleep_for_attempt(attempt)
         
     | 
| 
         @@ -31,8 +31,8 @@ describe Fluent::LogtailOutput do 
     | 
|
| 
       31 
31 
     | 
    
         
             
                it "should send a chunked request to the Logtail API" do
         
     | 
| 
       32 
32 
     | 
    
         
             
                  stub = stub_request(:post, "https://in.logtail.com/").
         
     | 
| 
       33 
33 
     | 
    
         
             
                    with(
         
     | 
| 
       34 
     | 
    
         
            -
                      :body => start_with("\x85\xA3age\x1A\xAArequest_id\xA242\xA9parent_id\xA6parent\xAArouting_id\xA7routing\xA2dt\xB4".force_encoding("ASCII-8BIT")),
         
     | 
| 
       35 
     | 
    
         
            -
                      :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer abcd1234', 'Content-Type'=>'application/msgpack', 'User-Agent'=>'Logtail Fluentd/0. 
     | 
| 
      
 34 
     | 
    
         
            +
                      :body => start_with("\xDD\x00\x00\x00\x01\x85\xA3age\x1A\xAArequest_id\xA242\xA9parent_id\xA6parent\xAArouting_id\xA7routing\xA2dt\xB4".force_encoding("ASCII-8BIT")),
         
     | 
| 
      
 35 
     | 
    
         
            +
                      :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer abcd1234', 'Content-Type'=>'application/msgpack', 'User-Agent'=>'Logtail Fluentd/0.2.0'}
         
     | 
| 
       36 
36 
     | 
    
         
             
                    ).
         
     | 
| 
       37 
37 
     | 
    
         
             
                    to_return(:status => 202, :body => "", :headers => {})
         
     | 
| 
       38 
38 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: fluent-plugin-logtail
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Logtail.com
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-08-31 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: fluentd
         
     | 
| 
         @@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       106 
106 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       107 
107 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       108 
108 
     | 
    
         
             
            requirements: []
         
     | 
| 
       109 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 109 
     | 
    
         
            +
            rubygems_version: 3.3.3
         
     | 
| 
       110 
110 
     | 
    
         
             
            signing_key:
         
     | 
| 
       111 
111 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       112 
112 
     | 
    
         
             
            summary: Logtail.com plugin for Fluentd
         
     |