Skip to content

Instantly share code, notes, and snippets.

@kyberorg
Created June 9, 2022 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyberorg/7bd0811883260ffd82b3a5929d72b474 to your computer and use it in GitHub Desktop.
Save kyberorg/7bd0811883260ffd82b3a5929d72b474 to your computer and use it in GitHub Desktop.
Loki
# Loki Config file
# based on https://github.com/grafana/loki/blob/master/cmd/loki/loki-docker-config.yaml
# Documentation: https://grafana.com/docs/loki/latest/configuration/
# The module to run Loki with. Supported values
# all, distributor, ingester, querier, query-frontend, table-manager.
# [target: <string> | default = "all"]
target: all
# Enables authentication through the X-Scope-OrgID header, which must be present
# if true. If false, the OrgID will always be set to "fake".
auth_enabled: false
# Configures the server of the launched module(s).
server:
http_listen_port: 3100
http_server_read_timeout: 60s # allow longer time span queries
http_server_write_timeout: 60s # allow longer time span queries
grpc_server_max_recv_msg_size: 33554432 # 32MiB (int bytes), default 4MB
grpc_server_max_send_msg_size: 33554432 # 32MiB (int bytes), default 4MB
# Log only messages with the given severity or above. Supported values [debug,
# info, warn, error]
# CLI flag: -log.level
log_level: info
# Configures the ingester and how the ingester will register itself to a
# key value store.
ingester:
lifecycler:
final_sleep: 0s
chunk_idle_period: 1h # Any chunk not receiving new logs in this time will be flushed
max_chunk_age: 1h # All chunks will be flushed when they hit this age, default is 1h
chunk_target_size: 1048576 # Loki will attempt to build chunks up to 1.5MB, flushing first if chunk_idle_period or max_chunk_age is reached first
chunk_retain_period: 30s # Must be greater than index read cache TTL if using an index cache (Default index read cache TTL is 5m)
max_transfer_retries: 0 # Chunk transfers disabled
schema_config:
configs:
- from: 2020-11-01
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
boltdb:
directory: /data/loki/index
filesystem:
directory: /data/loki/chunks
boltdb_shipper:
active_index_directory: /data/loki/boltdb-shipper-active
cache_location: /data/loki/boltdb-shipper-cache
cache_ttl: 72h # Can be increased for faster performance over longer query periods, uses more disk space
shared_store: filesystem
compactor:
working_directory: /data/loki/boltdb-shipper-compactor
shared_store: filesystem
compaction_interval: 10m
retention_enabled: true
retention_delete_delay: 2h
retention_delete_worker_count: 150
limits_config:
retention_period: 91d
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
# Per-user ingestion rate limit in sample size per second. Units in MB.
# CLI flag: -distributor.ingestion-rate-limit-mb
ingestion_rate_mb: 8 # <float> | default = 4]
# Per-user allowed ingestion burst size (in sample size). Units in MB.
# The burst size refers to the per-distributor local rate limiter even in the
# case of the "global" strategy, and should be set at least to the maximum logs
# size expected in a single push request.
# CLI flag: -distributor.ingestion-burst-size-mb
ingestion_burst_size_mb: 16 # <int> | default = 6]
# Maximum byte rate per second per stream,
# also expressible in human readable forms (1MB, 256KB, etc).
# CLI flag: -ingester.per-stream-rate-limit
per_stream_rate_limit: 5MB # <string|int> | default = "3MB"
# Maximum burst bytes per stream,
# also expressible in human readable forms (1MB, 256KB, etc).
# This is how far above the rate limit a stream can "burst" before the stream is limited.
# CLI flag: -ingester.per-stream-rate-limit-burst
per_stream_rate_limit_burst: 15MB # <string|int> | default = "15MB"
# The limit to length of chunk store queries. 0 to disable.
# CLI flag: -store.max-query-length
max_query_length: 2165h # <duration> | default = 721h
# Limit how far back in time series data and metadata can be queried,
# up until lookback duration ago.
# This limit is enforced in the query frontend, the querier and the ruler.
# If the requested time range is outside the allowed range, the request will not fail,
# but will be modified to only query data within the allowed time range.
# The default value of 0 does not set a limit.
# CLI flag: -querier.max-query-lookback
max_query_lookback: 90d
# # no longer used by default. retention is done by compactor
# table_manager:
# retention_deletes_enabled: true
# retention_period: 91d
querier:
max_concurrent: 20
frontend:
# Maximum number of outstanding requests per tenant per frontend; requests
# beyond this error with HTTP 429.
# CLI flag: -querier.max-outstanding-requests-per-tenant
max_outstanding_per_tenant: 2048 # default = 100]
# Compress HTTP responses.
# CLI flag: -querier.compress-http-responses
compress_responses: true # default = false]
# Log queries that are slower than the specified duration. Set to 0 to disable.
# Set to < 0 to enable on all queries.
# CLI flag: -frontend.log-queries-longer-than
log_queries_longer_than: 20s
frontend_worker:
grpc_client_config:
# The maximum size in bytes the client can send.
# CLI flag: -<prefix>.grpc-max-send-msg-size
max_send_msg_size: 33554432 # 32MiB, default = 16777216]
max_recv_msg_size: 33554432
ingester_client:
grpc_client_config:
# The maximum size in bytes the client can send.
# CLI flag: -<prefix>.grpc-max-send-msg-size
max_send_msg_size: 33554432 # 32mb, default = 16777216]
max_recv_msg_size: 33554432
query_scheduler:
max_outstanding_requests_per_tenant: 2048
grpc_client_config:
# The maximum size in bytes the client can send.
# CLI flag: -<prefix>.grpc-max-send-msg-size
max_send_msg_size: 33554432 # 32mb, default = 16777216]
max_recv_msg_size: 33554432
query_range:
split_queries_by_interval: 0 # 720h # 30d
ruler:
storage:
type: local
local:
directory: /data/loki/rules # volume, directory to scan for rules
rule_path: /data/loki/rules-temp # volume, store temporary rule files
alertmanager_url: "https://alertmanager.example.com"
enable_alertmanager_v2: true
alertmanager_client:
basic_auth_username: "{{ loki_alertmanager_username }}"
basic_auth_password: "{{ loki_alertmanager_password }}"
# Common config to be shared between multiple modules.
# If a more specific config is given in other sections, the related config under this section
# will be ignored.
common:
path_prefix: /data/loki
# storage:
# filesystem:
# chunks_directory: /data/loki/chunks
# rules_directory: /data/loki/rules
replication_factor: 1
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment