Skip to content

Commit 52ce9d0

Browse files
Migrate to Grafana Alloy as the recommended replacement for log fwd (#379)
Changes: - Add alloy/config.alloy.example configuration - Move promtail/run.sh to alloy/run.sh - Update logging.yml to use Alloy - Remove promtail/config.yml.example --------- Co-authored-by: Kaloyan Tanev <[email protected]>
1 parent 08f9d2d commit 52ce9d0

File tree

13 files changed

+206
-161
lines changed

13 files changed

+206
-161
lines changed

.env.sample.holesky

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,14 @@ MEV_RELAYS=https://0xab78bf8c781c58078c3beb5710c57940874dd96aef2835e7742c866b4c7
157157
# Loki log aggregation server addresses. Disable loki log aggregation by setting an empty address.
158158
#CHARON_LOKI_ADDRESSES=
159159

160-
# Charon Cluster Name. Mandatory to send logs with Promtail.
161-
#CLUSTER_NAME=
160+
# Charon Cluster Name. Mandatory to send logs with Alloy and metrics with Prometheus.
161+
#CLUSTER_NAME=""
162162

163-
# Charon Cluster Peer. Mandatory to send logs with Promtail.
164-
#CLUSTER_PEER=
163+
# Charon Cluster Peer. Mandatory to send logs with Alloy and metrics with Prometheus.
164+
#CLUSTER_PEER=""
165165

166166
# Nickname to identify this charon node on monitoring (max 32 characters).
167-
#CHARON_NICKNAME=
167+
#CHARON_NICKNAME=""
168168

169169
# Docker network of running charon node. See `docker network ls`.
170170
#CHARON_DOCKER_NETWORK=
@@ -192,23 +192,23 @@ MEV_RELAYS=https://0xab78bf8c781c58078c3beb5710c57940874dd96aef2835e7742c866b4c7
192192
# Prometheus service owner used to uniquely identify user from which metrics are pushed.
193193
#SERVICE_OWNER=charon_user
194194

195-
# Uncomment these if you have log exporting with Promtail
195+
# Uncomment these if you have log exporting with Alloy
196196
# and want to disable log export on a particular container.
197-
#EL_NETHERMIND_PROMTAIL_MONITORED=false
198-
#EL_RETH_PROMTAIL_MONITORED=false
199-
#CL_LIGHTHOUSE_PROMTAIL_MONITORED=false
200-
#CL_GRANDINE_PROMTAIL_MONITORED=false
201-
#CL_TEKU_PROMTAIL_MONITORED=false
202-
#CL_LODESTAR_PROMTAIL_MONITORED=false
203-
#CHARON_PROMTAIL_MONITORED=false
204-
#VC_LODESTAR_PROMTAIL_MONITORED=false
205-
#VC_NIMBUS_PROMTAIL_MONITORED=false
206-
#VC_PRYSM_PROMTAIL_MONITORED=false
207-
#VC_TEKU_PROMTAIL_MONITORED=false
208-
#MEV_MEV_BOOST_PROMTAIL_MONITORED=false
209-
#MEV_COMMIT_BOOST_PROMTAIL_MONITORED=false
210-
#EJECTOR_PROMTAIL_MONITORED=false
211-
#DV_EXIT_PROMTAIL_MONITORED=false
197+
#EL_NETHERMIND_ALLOY_MONITORED=false
198+
#EL_RETH_ALLOY_MONITORED=false
199+
#CL_LIGHTHOUSE_ALLOY_MONITORED=false
200+
#CL_GRANDINE_ALLOY_MONITORED=false
201+
#CL_TEKU_ALLOY_MONITORED=false
202+
#CL_LODESTAR_ALLOY_MONITORED=false
203+
#CHARON_ALLOY_MONITORED=false
204+
#VC_LODESTAR_ALLOY_MONITORED=false
205+
#VC_NIMBUS_ALLOY_MONITORED=false
206+
#VC_PRYSM_ALLOY_MONITORED=false
207+
#VC_TEKU_ALLOY_MONITORED=false
208+
#MEV_MEV_BOOST_ALLOY_MONITORED=false
209+
#MEV_COMMIT_BOOST_ALLOY_MONITORED=false
210+
#EJECTOR_ALLOY_MONITORED=false
211+
#DV_EXIT_ALLOY_MONITORED=false
212212

213213
######### Debug Config #########
214214

.env.sample.hoodi

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,14 @@ MEV_RELAYS=https://0x98f0ef62f00780cf8eb06701a7d22725b9437d4768bb19b363e882ae871
157157
# Loki log aggregation server addresses. Disable loki log aggregation by setting an empty address.
158158
#CHARON_LOKI_ADDRESSES=
159159

160-
# Charon Cluster Name. Mandatory to send logs with Promtail.
161-
#CLUSTER_NAME=
160+
# Charon Cluster Name. Mandatory to send logs with Alloy and metrics with Prometheus.
161+
#CLUSTER_NAME=""
162162

163-
# Charon Cluster Peer. Mandatory to send logs with Promtail.
164-
#CLUSTER_PEER=
163+
# Charon Cluster Peer. Mandatory to send logs with Alloy and metrics with Prometheus.
164+
#CLUSTER_PEER=""
165165

166166
# Nickname to identify this charon node on monitoring (max 32 characters).
167-
#CHARON_NICKNAME=
167+
#CHARON_NICKNAME=""
168168

169169
# Docker network of running charon node. See `docker network ls`.
170170
#CHARON_DOCKER_NETWORK=
@@ -192,23 +192,23 @@ MEV_RELAYS=https://0x98f0ef62f00780cf8eb06701a7d22725b9437d4768bb19b363e882ae871
192192
# Prometheus service owner used to uniquely identify user from which metrics are pushed.
193193
#SERVICE_OWNER=charon_user
194194

195-
# Uncomment these if you have log exporting with Promtail
195+
# Uncomment these if you have log exporting with Alloy
196196
# and want to disable log export on a particular container.
197-
#EL_NETHERMIND_PROMTAIL_MONITORED=false
198-
#EL_RETH_PROMTAIL_MONITORED=false
199-
#CL_LIGHTHOUSE_PROMTAIL_MONITORED=false
200-
#CL_GRANDINE_PROMTAIL_MONITORED=false
201-
#CL_TEKU_PROMTAIL_MONITORED=false
202-
#CL_LODESTAR_PROMTAIL_MONITORED=false
203-
#CHARON_PROMTAIL_MONITORED=false
204-
#VC_LODESTAR_PROMTAIL_MONITORED=false
205-
#VC_NIMBUS_PROMTAIL_MONITORED=false
206-
#VC_PRYSM_PROMTAIL_MONITORED=false
207-
#VC_TEKU_PROMTAIL_MONITORED=false
208-
#MEV_MEV_BOOST_PROMTAIL_MONITORED=false
209-
#MEV_COMMIT_BOOST_PROMTAIL_MONITORED=false
210-
#EJECTOR_PROMTAIL_MONITORED=false
211-
#DV_EXIT_PROMTAIL_MONITORED=false
197+
#EL_NETHERMIND_ALLOY_MONITORED=false
198+
#EL_RETH_ALLOY_MONITORED=false
199+
#CL_LIGHTHOUSE_ALLOY_MONITORED=false
200+
#CL_GRANDINE_ALLOY_MONITORED=false
201+
#CL_TEKU_ALLOY_MONITORED=false
202+
#CL_LODESTAR_ALLOY_MONITORED=false
203+
#CHARON_ALLOY_MONITORED=false
204+
#VC_LODESTAR_ALLOY_MONITORED=false
205+
#VC_NIMBUS_ALLOY_MONITORED=false
206+
#VC_PRYSM_ALLOY_MONITORED=false
207+
#VC_TEKU_ALLOY_MONITORED=false
208+
#MEV_MEV_BOOST_ALLOY_MONITORED=false
209+
#MEV_COMMIT_BOOST_ALLOY_MONITORED=false
210+
#EJECTOR_ALLOY_MONITORED=false
211+
#DV_EXIT_ALLOY_MONITORED=false
212212

213213
######### Debug Config #########
214214

.env.sample.mainnet

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,14 @@ MEV_RELAYS=https://0xa15b52576bcbf1072f4a011c0f99f9fb6c66f3e1ff321f11f461d15e31b
157157
# Loki log aggregation server addresses. Disable loki log aggregation by setting an empty address.
158158
#CHARON_LOKI_ADDRESSES=
159159

160-
# Charon Cluster Name. Mandatory to send logs with Promtail.
161-
#CLUSTER_NAME=
160+
# Charon Cluster Name. Mandatory to send logs with Alloy and metrics with Prometheus.
161+
#CLUSTER_NAME=""
162162

163-
# Charon Cluster Peer. Mandatory to send logs with Promtail.
164-
#CLUSTER_PEER=
163+
# Charon Cluster Peer. Mandatory to send logs with Alloy and metrics with Prometheus.
164+
#CLUSTER_PEER=""
165165

166166
# Nickname to identify this charon node on monitoring (max 32 characters).
167-
#CHARON_NICKNAME=
167+
#CHARON_NICKNAME=""
168168

169169
# Docker network of running charon node. See `docker network ls`.
170170
#CHARON_DOCKER_NETWORK=
@@ -192,23 +192,23 @@ MEV_RELAYS=https://0xa15b52576bcbf1072f4a011c0f99f9fb6c66f3e1ff321f11f461d15e31b
192192
# Prometheus service owner used to uniquely identify user from which metrics are pushed.
193193
#SERVICE_OWNER=charon_user
194194

195-
# Uncomment these if you have log exporting with Promtail
195+
# Uncomment these if you have log exporting with Alloy
196196
# and want to disable log export on a particular container.
197-
#EL_NETHERMIND_PROMTAIL_MONITORED=false
198-
#EL_RETH_PROMTAIL_MONITORED=false
199-
#CL_LIGHTHOUSE_PROMTAIL_MONITORED=false
200-
#CL_GRANDINE_PROMTAIL_MONITORED=false
201-
#CL_TEKU_PROMTAIL_MONITORED=false
202-
#CL_LODESTAR_PROMTAIL_MONITORED=false
203-
#CHARON_PROMTAIL_MONITORED=false
204-
#VC_LODESTAR_PROMTAIL_MONITORED=false
205-
#VC_NIMBUS_PROMTAIL_MONITORED=false
206-
#VC_PRYSM_PROMTAIL_MONITORED=false
207-
#VC_TEKU_PROMTAIL_MONITORED=false
208-
#MEV_MEV_BOOST_PROMTAIL_MONITORED=false
209-
#MEV_COMMIT_BOOST_PROMTAIL_MONITORED=false
210-
#EJECTOR_PROMTAIL_MONITORED=false
211-
#DV_EXIT_PROMTAIL_MONITORED=false
197+
#EL_NETHERMIND_ALLOY_MONITORED=false
198+
#EL_RETH_ALLOY_MONITORED=false
199+
#CL_LIGHTHOUSE_ALLOY_MONITORED=false
200+
#CL_GRANDINE_ALLOY_MONITORED=false
201+
#CL_TEKU_ALLOY_MONITORED=false
202+
#CL_LODESTAR_ALLOY_MONITORED=false
203+
#CHARON_ALLOY_MONITORED=false
204+
#VC_LODESTAR_ALLOY_MONITORED=false
205+
#VC_NIMBUS_ALLOY_MONITORED=false
206+
#VC_PRYSM_ALLOY_MONITORED=false
207+
#VC_TEKU_ALLOY_MONITORED=false
208+
#MEV_MEV_BOOST_ALLOY_MONITORED=false
209+
#MEV_COMMIT_BOOST_ALLOY_MONITORED=false
210+
#EJECTOR_ALLOY_MONITORED=false
211+
#DV_EXIT_ALLOY_MONITORED=false
212212

213213
######### Debug Config #########
214214

alloy/config.alloy.example

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
discovery.docker "docker" {
2+
host = "unix:///var/run/docker.sock"
3+
}
4+
5+
loki.process "docker" {
6+
forward_to = [loki.write.default.receiver]
7+
8+
stage.docker { }
9+
}
10+
11+
discovery.relabel "docker" {
12+
targets = discovery.docker.docker.targets
13+
14+
rule {
15+
source_labels = ["__meta_docker_container_label_alloy_monitored"]
16+
regex = "true"
17+
action = "keep"
18+
}
19+
20+
rule {
21+
source_labels = ["__meta_docker_container_name"]
22+
regex = "/(.*)"
23+
target_label = "container"
24+
}
25+
26+
rule {
27+
source_labels = ["container"]
28+
regex = ".*charon.*"
29+
target_label = "job"
30+
replacement = "charon"
31+
}
32+
33+
rule {
34+
source_labels = ["container"]
35+
regex = ".*nethermind.*"
36+
target_label = "job"
37+
replacement = "nethermind"
38+
}
39+
40+
rule {
41+
source_labels = ["container"]
42+
regex = ".*lodestar.*"
43+
target_label = "job"
44+
replacement = "lodestar"
45+
}
46+
47+
rule {
48+
source_labels = ["container"]
49+
regex = ".*lighthouse.*"
50+
target_label = "job"
51+
replacement = "lighthouse"
52+
}
53+
54+
rule {
55+
source_labels = ["container"]
56+
regex = ".*mev-boost.*"
57+
target_label = "job"
58+
replacement = "mev-boost"
59+
}
60+
61+
rule {
62+
target_label = "cluster_name"
63+
replacement = "$CLUSTER_NAME"
64+
}
65+
66+
rule {
67+
target_label = "cluster_peer"
68+
replacement = "$CLUSTER_PEER"
69+
}
70+
}
71+
72+
loki.source.docker "docker" {
73+
host = "unix:///var/run/docker.sock"
74+
targets = discovery.docker.docker.targets
75+
forward_to = [loki.process.docker.receiver]
76+
relabel_rules = discovery.relabel.docker.rules
77+
}
78+
79+
loki.write "default" {
80+
endpoint {
81+
url = "$CHARON_LOKI_ADDRESSES"
82+
}
83+
external_labels = {
84+
cluster_name = "$CLUSTER_NAME",
85+
cluster_peer = "$CLUSTER_PEER",
86+
}
87+
}

alloy/run.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
if [ -z "${CHARON_LOKI_ADDRESSES:-}" ]; then
4+
echo "Error: \$CHARON_LOKI_ADDRESSES variable is empty" >&2
5+
exit 1
6+
fi
7+
8+
if [ -z "${CLUSTER_NAME:-}" ]; then
9+
echo "Error: \$CLUSTER_NAME variable is empty" >&2
10+
exit 1
11+
fi
12+
13+
if [ -z "${CLUSTER_PEER:-}" ]; then
14+
echo "Error: \$CLUSTER_PEER variable is empty" >&2
15+
exit 1
16+
fi
17+
18+
SRC="/etc/alloy/config.alloy.example"
19+
DST="/etc/alloy/config.alloy"
20+
21+
echo "Rendering template: $SRC -> $DST"
22+
23+
sed -e "s|\$CHARON_LOKI_ADDRESSES|${CHARON_LOKI_ADDRESSES}|g" \
24+
-e "s|\$CLUSTER_NAME|${CLUSTER_NAME}|g" \
25+
-e "s|\$CLUSTER_PEER|${CLUSTER_PEER}|g" \
26+
"$SRC" > "$DST"
27+
28+
echo "Config successfully rendered to $DST"
29+
30+
# Execute the command passed as arguments if any
31+
if [ $# -gt 0 ]; then
32+
echo "Executing: $@"
33+
exec "$@"
34+
fi

compose-cl.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
image: sifrai/grandine:${GRANDINE_VERSION:-2.0.1}
1616
restart: unless-stopped
1717
labels:
18-
- "promtail-monitored=${CL_GRANDINE_PROMTAIL_MONITORED:-true}"
18+
- "alloy-monitored=${CL_GRANDINE_ALLOY_MONITORED:-true}"
1919
command:
2020
- --data-dir=/root/.grandine
2121
- --eth1-rpc-urls=http://${EL}:8551
@@ -48,7 +48,7 @@ services:
4848
image: sigp/lighthouse:${LIGHTHOUSE_VERSION:-v8.0.1}
4949
restart: unless-stopped
5050
labels:
51-
- "promtail-monitored=${CL_LIGHTHOUSE_PROMTAIL_MONITORED:-true}"
51+
- "alloy-monitored=${CL_LIGHTHOUSE_ALLOY_MONITORED:-true}"
5252
command: |
5353
lighthouse bn
5454
--network=${NETWORK}
@@ -83,7 +83,7 @@ services:
8383
image: consensys/teku:${VC_VERSION:-25.12.0}
8484
restart: unless-stopped
8585
labels:
86-
- "promtail-monitored=${CL_TEKU_PROMTAIL_MONITORED:-true}"
86+
- "alloy-monitored=${CL_TEKU_ALLOY_MONITORED:-true}"
8787
command: |
8888
--network=${NETWORK}
8989
--checkpoint-sync-url=${LIGHTHOUSE_CHECKPOINT_SYNC_URL}
@@ -115,7 +115,7 @@ services:
115115
image: chainsafe/lodestar:${VC_VERSION:-v1.38.0}
116116
restart: unless-stopped
117117
labels:
118-
- "promtail-monitored=${CL_LODESTAR_PROMTAIL_MONITORED:-true}"
118+
- "alloy-monitored=${CL_LODESTAR_ALLOY_MONITORED:-true}"
119119
command: |
120120
beacon
121121
--network=${NETWORK}

compose-el.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ services:
1919
- ${EL_IP_HTTP:-127.0.0.1}:${EL_PORT_HTTP:-8545}:8545 # JSON-RPC
2020
- ${EL_IP_ENGINE:-127.0.0.1}:${EL_PORT_ENGINE:-8551}:8551 # ENGINE-API
2121
labels:
22-
- "promtail-monitored=${EL_NETHERMIND_PROMTAIL_MONITORED:-true}"
22+
- "alloy-monitored=${EL_NETHERMIND_ALLOY_MONITORED:-true}"
2323
command: |
2424
--config=${NETWORK}
2525
--data-dir=/nethermind/data
@@ -55,7 +55,7 @@ services:
5555
- ${EL_IP_HTTP:-127.0.0.1}:${EL_PORT_HTTP:-8545}:8545 # JSON-RPC
5656
- ${EL_IP_ENGINE:-127.0.0.1}:${EL_PORT_ENGINE:-8551}:8551 # ENGINE-API
5757
labels:
58-
- "promtail-monitored=${EL_RETH_PROMTAIL_MONITORED:-true}"
58+
- "alloy-monitored=${EL_RETH_ALLOY_MONITORED:-true}"
5959
command: |
6060
node
6161
--full

compose-mev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ services:
1717
volumes:
1818
- ./commit-boost/config.toml:/etc/commit-boost/config.toml:ro
1919
labels:
20-
- "promtail-monitored=${MEV_COMMIT_BOOST_PROMTAIL_MONITORED:-true}"
20+
- "alloy-monitored=${MEV_COMMIT_BOOST_ALLOY_MONITORED:-true}"
2121
networks: [dvnode]
2222
restart: unless-stopped
2323

@@ -40,6 +40,6 @@ services:
4040
-request-timeout-getpayload=${MEV_TIMEOUT_GETPAYLOAD:-4000}
4141
-request-timeout-regval=${MEV_TIMEOUT_REGVAL:-3000}
4242
labels:
43-
- "promtail-monitored=${MEV_MEV_BOOST_PROMTAIL_MONITORED:-true}"
43+
- "alloy-monitored=${MEV_MEV_BOOST_ALLOY_MONITORED:-true}"
4444
networks: [dvnode]
4545
restart: unless-stopped

0 commit comments

Comments
 (0)