DEV Community

Cover image for avalancheseqlogger
abdelkrim boutkhil
abdelkrim boutkhil

Posted on

avalancheseqlogger

avalancheseqlogger

When you work on custom subnets using avalanche-network-runner, you probably have logs all over the place.
You can have all your logs in one place using centralized logging solutions.

This is a tutorial of how to use Seq.

In this screenshot, you can see the logs from 4 nodes and 2 processes (avalancheGo and SubDotNetVm). You can filter the logs, expand lines to see the structured logs, and there is also a "tail" like mode.

Centralized logging using Seq
seq-running

I made very minimal modifications to avalanchego (4 lines of code in log/factory.go).

How to run

1) You need to run seq locally.

It's very easy to run seq in your local dev environment using docker.

docker run \
  --name seqtmp \
  -d \
  -e ACCEPT_EULA=Y \
  -v /tmp/seq:/data \
  -p 18080:80 \
  -p 5341:5341 \
  datalust/seq
Enter fullscreen mode Exit fullscreen mode

or if you use podman

podman run \
  --name seqtmp \
  -d \
  -e ACCEPT_EULA=Y \
  -v /tmp/seq:/data:Z \
  -p 18080:80 \
  -p 5341:5341 \
  datalust/seq
Enter fullscreen mode Exit fullscreen mode

2) Clone and build this modified version of avalanchego

In this exemple, we will clone it in /tmp but you can choose any folder you like.

cd /tmp
git clone https://github.com/subdotnet/avalanchego
cd avalanchego
./scripts/build.sh
Enter fullscreen mode Exit fullscreen mode

The compiled binary path is /tmp/avalanchego/build/avalanchego.

3) Install and run avalanche-network-runner

Install using these instructions
You will need two terminals for this :
Start avalanche-network-runner in one terminal

avalanche-network-runner server
Enter fullscreen mode Exit fullscreen mode

Start the nodes in another terminal

avalanche-network-runner control start \
--log-level info \
--number-of-nodes=4 \
--avalanchego-path /tmp/avalanchego/build/avalanchego
Enter fullscreen mode Exit fullscreen mode

4) Watch the logs

Open this url http://localhost:18080/ in your browser

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay