Skip to content

Instantly share code, notes, and snippets.

@michaelkebe
Created September 30, 2022 06:54
Show Gist options
  • Save michaelkebe/4b33bab82687d7bec8b7a9c0c148e6ff to your computer and use it in GitHub Desktop.
Save michaelkebe/4b33bab82687d7bec8b7a9c0c148e6ff to your computer and use it in GitHub Desktop.
Ordering of loki entries with same timestamp is wrong
version: "3"
services:
loki:
image: grafana/loki:2.6.1
command: -config.file=/etc/loki/loki-config.yml
ports:
- "3100:3100"
volumes:
- ./loki-config.yml:/etc/loki/loki-config.yml
logging:
driver: json-file
promtail:
image: grafana/promtail:2.6.1
command: -config.file=/etc/promtail/promtail-config.yml
volumes:
- ./promtail-config.yml:/etc/promtail/promtail-config.yml
- ./logfile.log:/tmp/logfile.log
depends_on:
- loki
logging:
driver: json-file
grafana:
image: grafana/grafana:9.1.6
environment:
GF_LOG_LEVEL: error
ports:
- "3000:3000"
volumes:
- ./grafana-datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml
depends_on:
- loki
logging:
driver: json-file
---
datasources:
- name: loki
type: loki
orgId: 1
url: "http://loki:3100"
1664088800 OLDEST
1664088801 OLDER
1664088802 OLD
1664088803 THIS SHOULD BE RIGHT NEXT TO line 1
1664088804 line 01
1664088804 line 02
1664088804 line 03
1664088804 line 04
1664088804 line 05
1664088804 line 06
1664088804 line 07
1664088804 line 08
1664088804 line 09
1664088804 line 10
1664088804 line 11
1664088804 line 12
1664088804 line 13
1664088804 line 14
1664088804 line 15
1664088804 line 16
1664088804 line 17
1664088804 line 18
1664088804 line 19
1664088804 line 20
1664088805 THIS SHOULD BE RIGHT NEXT TO line 20
1664088806 NEW
1664088807 NEWER
1664088808 NEWEST
1664518226 NOW
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
log_level: info
common:
path_prefix: /tmp/loki
storage:
filesystem:
chunks_directory: /tmp/loki/chunks
rules_directory: /tmp/loki/rules
replication_factor: 1
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
limits_config:
reject_old_samples: false
reject_old_samples_max_age: 9600h
max_query_length: 9600h # 400 days
ruler:
alertmanager_url: http://localhost:9093
analytics:
reporting_enabled: false
server:
http_listen_port: 9080
grpc_listen_port: 0
log_level: "debug"
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki:3100/loki/api/v1/push
scrape_configs:
- job_name: promtail
pipeline_stages:
- regex:
expression: '^(?P<timestamp>\d+).*$'
- timestamp:
source: timestamp
format: Unix
static_configs:
- targets:
- localhost
labels:
job: sametimestamps
__path__: /tmp/logfile.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment