fluent-plugin-rds-mysql-log 0.1.11 → 0.1.13
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-rds-mysql-log.gemspec +1 -1
 - data/lib/fluent/plugin/in_rds_mysql_log.rb +6 -22
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 77b346ae8c0eab97d93915d459002b6573a545b94f4fd2bba8bad896e3d866e8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bada832355054a08bdba2eb4a093b2d2f82f6d3f6b9a7ab645dcdebfdec96cef
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b20780f5f24d8b0ed76773e2d3c035be23cc6ef465523851346502e34428d5c777cd886946b05c793ec82e917bc9d40fdf185da3d1f002fa1dc69d3ae039406e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 72f7f4a1919b610b36a27b18ce35268fa7f624ad169a528b9f58ae51bcdd459e0afe722bc45587999f2ccf2885d3439bac055f5b171949dbd9bd16c86a5ca86d
         
     | 
| 
         @@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |spec|
         
     | 
| 
       7 
7 
     | 
    
         
             
              spec.name          = 'fluent-plugin-rds-mysql-log'
         
     | 
| 
       8 
     | 
    
         
            -
              spec.version       = '0.1. 
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = '0.1.13'
         
     | 
| 
       9 
9 
     | 
    
         
             
              spec.authors       = ['Junaid Ali']
         
     | 
| 
       10 
10 
     | 
    
         
             
              spec.email         = ['jonnie36@yahoo.com']
         
     | 
| 
       11 
11 
     | 
    
         
             
              spec.summary       = 'Amazon RDS Mysql logs input plugin'
         
     | 
| 
         @@ -8,7 +8,6 @@ class Fluent::Plugin::RdsMysqlLogInput < Fluent::Plugin::Input 
     | 
|
| 
       8 
8 
     | 
    
         
             
              helpers :timer
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              LOG_REGEXP = /^(?:(?<audit_logs>(?<timestamp>(\d{8})\s(\d{2}:\d{2}:\d{2})?),(?<serverhost>[^,]+?),(?<username>[^,]+?),(?<host>[^,]+?),(?<connectionid>[^,]+?),(?<queryid>[^,]+?),(?<operation>[^,]+?),(?<database>[^,]+?),'(?<query>.*?)',(?<retcode>[0-9]?),(?:,)?)|(?<other_logs>(?<time>(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}\.\d+Z)?)\s(?<thread_id>\d+?)\s\[(?<severity>([^\]]+)?)\]\s\[(?<error_code>([^\]]+)?)\]\s\[(?<subsystem>([^\]]+)?)\]\s((?<message>.+)?)))$/m
         
     | 
| 
       11 
     | 
    
         
            -
              AUDIT_LOG_PATTERN = /server_audit\.log(\.\d+)?$/i
         
     | 
| 
       12 
11 
     | 
    
         | 
| 
       13 
12 
     | 
    
         
             
              config_param :access_key_id, :string, :default => nil
         
     | 
| 
       14 
13 
     | 
    
         
             
              config_param :secret_access_key, :string, :default => nil
         
     | 
| 
         @@ -76,10 +75,6 @@ class Fluent::Plugin::RdsMysqlLogInput < Fluent::Plugin::Input 
     | 
|
| 
       76 
75 
     | 
    
         
             
                end
         
     | 
| 
       77 
76 
     | 
    
         
             
              end
         
     | 
| 
       78 
77 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
              def is_audit_logs?
         
     | 
| 
       80 
     | 
    
         
            -
                @pos_info.keys.any? { |log_file_name| log_file_name =~ AUDIT_LOG_PATTERN }
         
     | 
| 
       81 
     | 
    
         
            -
              end
         
     | 
| 
       82 
     | 
    
         
            -
              
         
     | 
| 
       83 
78 
     | 
    
         
             
              def should_track_marker?(log_file_name)
         
     | 
| 
       84 
79 
     | 
    
         
             
                return false if log_file_name == "audit/server_audit.log"
         
     | 
| 
       85 
80 
     | 
    
         | 
| 
         @@ -122,18 +117,11 @@ class Fluent::Plugin::RdsMysqlLogInput < Fluent::Plugin::Input 
     | 
|
| 
       122 
117 
     | 
    
         
             
                begin
         
     | 
| 
       123 
118 
     | 
    
         
             
                  log.debug "get logfile-list from rds: db_instance_identifier=#{@db_instance_identifier}, pos_last_written_timestamp=#{@pos_last_written_timestamp}"
         
     | 
| 
       124 
119 
     | 
    
         | 
| 
       125 
     | 
    
         
            -
                   
     | 
| 
       126 
     | 
    
         
            -
                    @ 
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
                  else
         
     | 
| 
       131 
     | 
    
         
            -
                    @rds.describe_db_log_files(
         
     | 
| 
       132 
     | 
    
         
            -
                      db_instance_identifier: @db_instance_identifier,
         
     | 
| 
       133 
     | 
    
         
            -
                      file_last_written: @pos_last_written_timestamp,
         
     | 
| 
       134 
     | 
    
         
            -
                      max_records: 50,
         
     | 
| 
       135 
     | 
    
         
            -
                    )
         
     | 
| 
       136 
     | 
    
         
            -
                  end
         
     | 
| 
      
 120 
     | 
    
         
            +
                  @rds.describe_db_log_files(
         
     | 
| 
      
 121 
     | 
    
         
            +
                    db_instance_identifier: @db_instance_identifier,
         
     | 
| 
      
 122 
     | 
    
         
            +
                    file_last_written: @pos_last_written_timestamp,
         
     | 
| 
      
 123 
     | 
    
         
            +
                    max_records: 10,
         
     | 
| 
      
 124 
     | 
    
         
            +
                  )
         
     | 
| 
       137 
125 
     | 
    
         
             
                rescue => e
         
     | 
| 
       138 
126 
     | 
    
         
             
                  log.warn "RDS Client describe_db_log_files error occurred: #{e.message}"
         
     | 
| 
       139 
127 
     | 
    
         
             
                end
         
     | 
| 
         @@ -147,11 +135,7 @@ class Fluent::Plugin::RdsMysqlLogInput < Fluent::Plugin::Input 
     | 
|
| 
       147 
135 
     | 
    
         
             
                      @pos_last_written_timestamp = item[:last_written] if @pos_last_written_timestamp < item[:last_written]
         
     | 
| 
       148 
136 
     | 
    
         | 
| 
       149 
137 
     | 
    
         
             
                      log_file_name = item[:log_file_name]
         
     | 
| 
       150 
     | 
    
         
            -
                      marker =  
     | 
| 
       151 
     | 
    
         
            -
                                  @pos_info.has_key?(log_file_name) ? @pos_info[log_file_name] : "0"
         
     | 
| 
       152 
     | 
    
         
            -
                               else 
         
     | 
| 
       153 
     | 
    
         
            -
                                  "0"
         
     | 
| 
       154 
     | 
    
         
            -
                               end
         
     | 
| 
      
 138 
     | 
    
         
            +
                      marker = should_track_marker?(log_file_name) ? @pos_info[log_file_name] || "0" : "0"
         
     | 
| 
       155 
139 
     | 
    
         | 
| 
       156 
140 
     | 
    
         
             
                      log.debug "download log from rds: log_file_name=#{log_file_name}, marker=#{marker}"
         
     | 
| 
       157 
141 
     | 
    
         
             
                      logs = @rds.download_db_log_file_portion(
         
     |