loki4j / loki-logback-appender

Fast and lightweight implementation of Logback appender for Grafana Loki
https://loki4j.github.io/loki-logback-appender/
BSD 2-Clause "Simplified" License
300 stars 26 forks source link

log'sorted #22

Closed u2young closed 3 years ago

u2young commented 3 years ago

I hope the log will be sorted in the same way as before after Loki restarts

PS:

<sortByTime>true</sortByTime>
auth_enabled: false
server:
  http_listen_port: 3100
ingester:
  lifecycler:
    address: 127.0.0.1
    ring:
      kvstore:
        store: inmemory
      replication_factor: 1
    final_sleep: 0s
  chunk_idle_period: 1h      
  max_chunk_age: 1h           
  chunk_target_size: 1048576  
  chunk_retain_period: 30s   
  max_transfer_retries: 0    
schema_config:
  configs:
  - from: 2020-11-11
    store: boltdb
    object_store: filesystem
    schema: v11
    index:
      prefix: index_
      period: 168h
storage_config:
  boltdb:
    directory: E:\server\loki\boltdb_index
  filesystem:
    directory: E:\server\loki\filesystem_chunks
limits_config:
  enforce_metric_name: false
  reject_old_samples: true
  reject_old_samples_max_age: 168h

image

nehaev commented 3 years ago

sortByTime setting is only for sorting log events inside each batch before sending it from Logback to Loki. It is designed to prevent message loss when Loki rejects old messages with 'entry out of order' error. So if you don't see 'entry out of order' error, it means that sortByTime works as expected.

This setting has nothing to do with how Loki stores/returns these events or how Grafana displays them. So, if I didn't miss anything, the issue you describe doesn't seem to be on Loki4j's side.

Please let me know if you have any questions.

u2young commented 3 years ago

thx