Skip to content

Commit 4087c3d

Browse files
committed
Merge remote-tracking branch 'upstream/main' into 2025/refactor/pgBackup
2 parents 5482bf0 + abc22cd commit 4087c3d

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

services/logging/Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,24 @@ STACK_NAME = $(notdir $(shell pwd))
77
TEMP_COMPOSE=.stack.${STACK_NAME}.yaml
88
REPO_BASE_DIR := $(shell git rev-parse --show-toplevel)
99

10+
define create-s3-bucket
11+
# ensure bucket is available in S3...
12+
set -o allexport; \
13+
source .env; \
14+
echo Creating bucket "$${S3_BUCKET_NAME_LOKI}";\
15+
export S3_ACCESS_KEY=$${S3_ACCESS_KEY_LOKI}; \
16+
export S3_SECRET_KEY=$${S3_SECRET_KEY_LOKI}; \
17+
export STORAGE_DOMAIN=$${STORAGE_DOMAIN}; \
18+
${REPO_BASE_DIR}/scripts/create-s3-bucket.bash "$${S3_BUCKET_NAME_LOKI}" && \
19+
set +o allexport; \
20+
# bucket is available in S3
21+
endef
22+
1023
# TARGETS --------------------------------------------------
1124
include ${REPO_BASE_DIR}/scripts/common.Makefile
1225

1326
.PHONY: up
14-
up: .init .env ${TEMP_COMPOSE} ## Deploys graylog stack
27+
up: .init .env ${TEMP_COMPOSE} ## Deploys logging stack
1528
@docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE} ${STACK_NAME}
1629
$(MAKE) configure
1730

@@ -43,6 +56,7 @@ up-master: .init .env ${TEMP_COMPOSE}-master
4356

4457
.PHONY: up-local ## Deploys graylog stack for local deployment
4558
up-local: .init .env ${TEMP_COMPOSE}-local ## Deploys graylog stack for local cluster
59+
@$(create-s3-bucket)
4660
@docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE}-local ${STACK_NAME}
4761
$(MAKE) configure
4862

services/logging/fluentd/fluent.conf

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
@type forward
3131
port 24224
3232
bind 0.0.0.0
33+
# Add source hostname to records
34+
source_hostname_key source_hostname
3335
</source>
3436

3537
# Add additional metadata
@@ -38,10 +40,22 @@
3840
<record>
3941
hostname "#{Socket.gethostname}"
4042
fluentd_hostname "#{ENV['FLUENTD_HOSTNAME']}"
41-
tag ${tag}
4243
</record>
4344
</filter>
4445

46+
# Clean container names and set proper host field
47+
<filter docker.**>
48+
@type record_transformer
49+
enable_ruby true
50+
<record>
51+
# cleanup container names by removing leading slashes
52+
container_name ${record["container_name"] ? record["container_name"].sub(/^\//, '') : record["container_name"]}
53+
# Use source hostname from forward input as the host field for GELF
54+
host ${record["source_hostname"] || record["source"] || record["_hostname"] || "unknown"}
55+
</record>
56+
</filter>
57+
58+
4559
# Output to both Graylog (GELF) and Loki
4660
<match docker.**>
4761
@type copy
@@ -54,6 +68,12 @@
5468
protocol udp
5569
add_msec_time true
5670
flush_interval 5s
71+
# Use the host field from record for GELF host field
72+
use_record_host true
73+
# Map the correct fields for Graylog
74+
<format>
75+
@type json
76+
</format>
5777
<buffer>
5878
@type file
5979
path /fluentd/buffer/graylog

services/logging/template.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ GRAYLOG_LOG_MAX_DAYS_IN_STORAGE=${GRAYLOG_LOG_MAX_DAYS_IN_STORAGE}
1616
GRAYLOG_LOG_MIN_DAYS_IN_STORAGE=${GRAYLOG_LOG_MIN_DAYS_IN_STORAGE}
1717
PUBLIC_NETWORK=${PUBLIC_NETWORK}
1818
MONITORED_NETWORK=${MONITORED_NETWORK}
19-
LOKI_RETETION_PERIOD=${LOKI_RETETION_PERIOD}
19+
LOKI_RETENTION_PERIOD=${LOKI_RETENTION_PERIOD}
2020
S3_ENDPOINT_LOKI=${S3_ENDPOINT_LOKI}
2121
S3_ACCESS_KEY_LOKI=${S3_ACCESS_KEY_LOKI}
2222
S3_BUCKET_NAME_LOKI=${S3_BUCKET_NAME_LOKI}
2323
S3_FORCE_PATH_STYLE_LOKI=${S3_FORCE_PATH_STYLE_LOKI}
2424
S3_REGION_LOKI=${S3_REGION_LOKI}
2525
S3_SECRET_KEY_LOKI=${S3_SECRET_KEY_LOKI}
26+
STORAGE_DOMAIN=${STORAGE_DOMAIN}

services/monitoring/prometheus/prometheus.rules.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,8 @@ groups:
4242
rules:
4343
- record: osparc_autoscaling_machines_buffer
4444
expr: sum(swarm_node_info{instance=~"^ip-.*$"}) - ( sum(count_values("instance",node_boot_time_seconds{instance=~"^ip-.*$"})) OR clamp_max(absent(node_boot_time_seconds{instance=~"^ip-.*$"}),0) )
45+
- name: osparc_ops_cpu_throttling_seconds
46+
interval: 120s
47+
rules:
48+
- record: osparc_ops_cpu_throttling_seconds
49+
expr: sum by (name) (rate(container_cpu_cfs_throttled_seconds_total[5m])) > 0.2

0 commit comments

Comments
 (0)