loki: add

This commit is contained in:
Schneider Roland 2024-10-27 10:50:14 +01:00
parent 9986c3d695
commit 1c7ecec6ab
4 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,22 @@
version: '3.8'
services:
loki:
image: grafana/loki:3.0.0 # Specifies the Loki Docker image and version.
container_name: loki # Names the container for easier management.
volumes:
- ./loki-config.yaml:/mnt/config/loki-config.yaml # Mounts the Loki configuration file.
- ./data:/tmp
ports:
- "3100:3100" # Maps port 3100 on the host to port 3100 in the container.
command: -config.file=/mnt/config/loki-config.yaml # Runs Loki with the specified configuration file.
promtail:
image: grafana/promtail:3.0.0 # Specifies the Promtail Docker image and version.
container_name: promtail # Names the container for easier management.
volumes:
- ./promtail-config.yaml:/mnt/config/promtail-config.yaml # Mounts the Promtail configuration file.
- /var/log:/var/log # Mounts the host's log directory.
depends_on:
- loki # Ensures Promtail starts after Loki.
command: -config.file=/mnt/config/promtail-config.yaml # Runs Promtail with the specified configuration file.

View File

@ -0,0 +1,50 @@
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
common:
instance_addr: 127.0.0.1
path_prefix: /tmp/loki
storage:
filesystem:
chunks_directory: /tmp/loki/chunks
rules_directory: /tmp/loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory
query_range:
results_cache:
cache:
embedded_cache:
enabled: true
max_size_mb: 100
schema_config:
configs:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
ruler:
alertmanager_url: http://localhost:9093
# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
# Statistics help us better understand how Loki is used, and they show us performance
# levels for most users. This helps us prioritize features and documentation.
# For more information on what's sent, look at
# https://github.com/grafana/loki/blob/main/pkg/analytics/stats.go
# Refer to the buildReport method to see what goes into a report.
#
# If you would like to disable reporting, uncomment the following lines:
analytics:
reporting_enabled: false

View File

@ -0,0 +1,18 @@
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki:3100/loki/api/v1/push
scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*log

26
loki/jenkins/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,26 @@
pipeline {
agent any
stages {
stage('Git pull && docker compose restart') {
steps {
sshPublisher(publishers: [sshPublisherDesc(configName: 'infra.1', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''cd /home/rschneider/infra
git pull
cd /home/rschneider/infra/loki/docker-compose/loki
docker compose down
docker compose up -d
''', execTimeout: 120000,
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: '',
remoteDirectorySDF: false,
removePrefix: '', sourceFiles: '')],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: true)])
}
}
}
}