Method: Loki::Batch#add
- Defined in:
- lib/logstash/outputs/loki/batch.rb
#add(e) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/logstash/outputs/loki/batch.rb', line 17 def add(e) @bytes = @bytes + e.entry['line'].length # Append the entry to an already existing stream (if any) labels = e.labels.sort.to_h labelkey = labels.to_s if @streams.has_key?(labelkey) stream = @streams[labelkey] stream['entries'].append(e.entry) return else # Add the entry as a new stream @streams[labelkey] = { "labels" => labels, "entries" => [e.entry], } end end |