Method: Loki::Batch#build_stream

Defined in:
lib/logstash/outputs/loki/batch.rb

#build_stream(stream) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/logstash/outputs/loki/batch.rb', line 52

def build_stream(stream)
    values = []
    stream['entries'].each { |entry|
        if entry.key?('metadata')
             = entry['metadata'].sort.to_h
            values.append([
                entry['ts'].to_s,
                entry['line'],
                
            ])
        else
            values.append([
                entry['ts'].to_s,
                entry['line']
            ])
        end
    }
    return {
        'stream'=>stream['labels'],
        'values' => values
    }
end