Skip to content

Commit 1f5ee4d

Browse files
committed
feat: store localnet logs between runs, remove excessive rm and clean commands from tmp_log folder, fix promtail config to point it to the right place, add named volume to the docker-compose to store logs between runs, make debug-start-log more user-friendly
1 parent 9dba11d commit 1f5ee4d

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ travis_rosetta_checker:
236236
TEST_REPO_BRANCH='master'
237237
bash ./scripts/travis_rosetta_checker.sh
238238

239-
debug_external: clean
239+
debug_external:
240240
bash test/debug-external.sh
241241

242242
build_localnet_validator:

test/debug.sh

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Localnet_Blocks_Per_Epoch=$2
66
Localnet_Blocks_Per_Epoch_V2=$3
77

88
./test/kill_node.sh
9-
rm -rf tmp_log* 2> /dev/null
109
rm *.rlp 2> /dev/null
1110
rm -rf .dht* 2> /dev/null
1211
scripts/go_executable_build.sh -S || exit 1 # dynamic builds are faster for debug iteration...

test/logs_aggregator/docker-compose.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ services:
1010
container_name: promtail
1111
image: grafana/promtail:latest
1212
volumes:
13-
- ./promtail-config.yml:/etc/promtail/promtail-config.yaml
14-
- ${CURRENT_SESSION_LOGS}:/var/log/
13+
- ./promtail-config.yml:/etc/promtail/config.yml
14+
- log_data:/var/log/
1515
grafana:
1616
container_name: grafana
1717
image: grafana/grafana
@@ -23,3 +23,11 @@ services:
2323
- 3000:3000
2424
volumes:
2525
- ./loki-datasource.yaml:/etc/grafana/provisioning/datasources/loki-datasource.yaml
26+
27+
volumes:
28+
log_data:
29+
driver: local
30+
driver_opts:
31+
type: none
32+
o: bind
33+
device: ${LOG_FOLDER}

test/logs_aggregator/promtail-config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ scrape_configs:
1515
- "localhost"
1616
labels:
1717
job: varlogs
18-
__path__: /var/log/*.log
18+
__path__: /var/log/log*/*.log

test/logs_aggregator/start_log_aggregator.sh

+8-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ set -eou pipefail
55
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
66
echo "working in ${DIR}"
77
cd $DIR && pwd
8-
logs="$(ls -1 '../../tmp_log/')"
9-
path="$(readlink -f '../../tmp_log/')"
10-
echo "Current localnet logs are placed into '${path}/${logs}'"
11-
echo "CURRENT_SESSION_LOGS='${path}/${logs}'" > .env
12-
echo "CURRENT_SESSION_LOGS='${path}/${logs}'"
13-
echo "starting docker compose lor log aggregation"
8+
path="$(readlink -f '../../tmp_log/')/"
9+
loki_path="$(find ${path} -type d | sort | tail -n 1)"
10+
loki_path=$(echo "${loki_path}" | sed "s#.*/tmp_log/#/var/log/#")
11+
echo "LOG_FOLDER='${path}'" > .env
12+
echo "starting docker compose for log aggregation"
1413
docker compose up --detach
1514
sleep 5
15+
echo "Whole list of log folders"
16+
find ${path} -type d | sort | grep 'log-'
1617
echo "Opening Grafana"
1718
python3 -m webbrowser "http://localhost:3000/explore"
19+
echo "Please, use {filename=~\"${loki_path}/.*\"} to get the latest run localnet logs"

0 commit comments

Comments
 (0)