lib/fluent/plugin/out_google_cloud.rb
# Group the log entries by tag and local_resource_id pairs. Also filter out
# invalid non-Hash entries.
Group the log entries by tag and local_resource_id pairs. Also filter out
invalid non-Hash entries.
Group the log entries by tag and local_resource_id pairs . Also filter out invalid non - Hash entries .
def group_log_entries_by_tag_and_local_resource_id(chunk)
      groups = {}
      chunk.msgpack_each do |tag, time, record|
        unless record.is_a?(Hash)
          @log.warn 'Dropping log entries with malformed record: ' \
                    "'#{record.inspect}' from tag '#{tag}' at '#{time}'. " \
                    'A log record should be in JSON format.'
          next
        end
        sanitized_tag = sanitize_tag(tag)
        if sanitized_tag.nil?
          @log.warn "Dropping log entries with invalid tag: '#{tag.inspect}'." \
                    ' A tag should be a string with utf8 characters.'
          next
        end
        local_resource_id = record.delete(LOCAL_RESOURCE_ID_KEY)
        hash_key = [sanitized_tag, local_resource_id].freeze
        groups[hash_key] ||= []
        groups[hash_key].push([time, record])
      end
      groups
    end
def group_log_entries_by_tag_and_local_resource_id ( chunk ) groups = { } chunk . msgpack_each do | tag , time , record | unless record . is_a? ( Hash ) @log . warn 'Dropping log entries with malformed record: ' "'#{record.inspect}' from tag '#{tag}' at '#{time}'. " 'A log record should be in JSON format.' next end sanitized_tag = sanitize_tag ( tag ) if sanitized_tag . nil? @log . warn "Dropping log entries with invalid tag: '#{tag.inspect}'." ' A tag should be a string with utf8 characters.' next end local_resource_id = record . delete ( LOCAL_RESOURCE_ID_KEY ) hash_key = [ sanitized_tag , local_resource_id ] . freeze groups [ hash_key ] ||= [ ] groups [ hash_key ] . push ( [ time , record ] ) end groups end
Group the log entries by tag and local_resource_id pairs.
Group the log entries by tag and local_resource_id pairs .
# A nil local_resource_id means "fall back to legacy".
chunk
<not_specific>