loki label best practices

created : Thu, 22 Dec 2022 13:03:25 +0900
modified : Thu, 22 Dec 2022 13:03:25 +0900
loki

Grafana Loki label best practices (loki 에서 label 을 붙이는 모범 사례)

Static labels are good (static labels 이 좋습니다.)

Use dynamic labels sparingly (동적 labels 은 조금만 쓰세요)

Label values must always be bounded (label은 언제나 제한(bounded)되어야만 합니다.)

Be aware of dynamic labels applied by clients (dynamic labels 은 licent 에서 적용된 다는 사실을 기억하자)

Total Streams:  25017
Unique Labels:  8

Label Name  Unique Values  Found In Streams
requestId   24653          24979
logStream   1194           25016
logGroup    140            25016
accountId   13             25016
logger      1              25017
source      1              25016
transport   1              25017
format      1              25017

Configure caching

Time ordering of logs

{job="syslog"} 00:00:00 i'm a syslog!
{job="syslog"} 00:00:01 i'm a syslog!
{job="syslog"} 00:00:00 i'm a syslog!
{job="syslog"} 00:00:02 i'm a syslog!
{job="syslog"} 00:00:01 i'm a syslog!  <- Rejected out of order!
{job="syslog", instance="host1"} 00:00:00 i'm a syslog!
{job="syslog", instance="host1"} 00:00:02 i'm a syslog!
{job="syslog", instance="host2"} 00:00:01 i'm a syslog!  <- Accepted, this is a new stream!
{job="syslog", instance="host1"} 00:00:03 i'm a syslog!  <- Accepted, still in order for stream 1
{job="syslog", instance="host2"} 00:00:02 i'm a syslog!  <- Accepted, still in order for stream 2

Use chunk_target_size (chunk_target_size 를 사용하세요)

Use -print-config-stderr or -log-config-reverse-order (-print-config-stderr 이나 -log-config-reverse-order 를 사용하세요)

개인 생각