Skip to content

Commit d59c0b5

Browse files
authored
fix: turn off logging stderr+out to file (#454)
* fix: turn off logging stderr+out to file Removing the log file so we can just log to the container stdout and stderr to be picked up by Loki or other means. * fix: fixed depends_on to the actual loki service name * chore: updated README.md about logs Specifically we changed the container entry.sh script to not redirect the logs to files. This enables log scraping directly from the containers into log collection services like Loki.
1 parent 4281a4a commit d59c0b5

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

narwhal/Docker/README.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,14 @@ since the narwhal node binary needs to be built from the source code.) And then
3636
a cluster for *four nodes* by doing the necessary setup for `primary` and `worker` nodes. Each
3737
`primary` node will be connected to *one worker* node.
3838

39-
The logs for each validator (primary & worker nodes) can be found in the `logs` folder under the corresponding
40-
validator folder.
41-
42-
> **Note**: You will find across the codebase the name *Authority* when we describe
43-
> the entity participating in the Narwhal protocol that verifies and signs the produced headers. An
44-
> authority is composed of a `primary` node and one or more `worker` nodes. Since Authority is not a widely
45-
> used term, we are referring instead to our *primary + worker* node pairs as **Validator**.
46-
47-
The `logs` folder is created once the node is bootstrapped via `docker-compose`.
48-
For example, for the primary node of the validator-0, the logs will be found in
49-
the folder `validators/validator-0/logs` with the name `log-primary.txt`. To monitor
50-
the logging of a node in real time, simply `tail` the log:
39+
The logs from the `primary` and `worker` nodes are available via
5140
```
52-
$ tail -f validators/validator-0/logs/log-primary.txt
41+
docker-compose logs primary_<num>
42+
43+
docker-compose logs worker_<num>
5344
```
5445

55-
By default, the production (release) version of the Narwhal node will be compiled when the Docker image is being built.
46+
By default, the production (release) version of the Narwhal node will be compiled when the Docker image is being built.
5647
To build the Docker image with the development version of Narwhal, which will lead to smaller compile times and
5748
smaller binary (and image) size, you run the `docker-compose` command as:
5849
```
@@ -223,6 +214,10 @@ Loki is a log collector and processor. It is exposed as a datasource
223214
in Grafana and makes the logs easily searchable.
224215
- https://grafana.com/oss/loki/
225216

217+
Currently there are no Loki dashboards defined, however you can
218+
browse the logs via the "Explorer", selecting the Loki datasource.
219+
220+
226221
## Troubleshooting
227222

228223
#### 1. Compile errors when building Docker image

narwhal/Docker/entry.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ else
1515
if [[ "$NODE_TYPE" = "primary" ]]; then
1616
# Clean up only the primary node's data
1717
rm -r "/validators/validator-$VALIDATOR_ID/db-primary"
18-
rm -r "/validators/validator-$VALIDATOR_ID/logs/log-primary.txt"
1918
elif [[ "$NODE_TYPE" = "worker" ]]; then
2019
# Clean up only the specific worker's node data
2120
rm -r "/validators/validator-$VALIDATOR_ID/db-worker-${WORKER_ID}"
22-
rm -r "/validators/validator-$VALIDATOR_ID/logs/log-worker-${WORKER_ID}.txt"
2321
fi
2422
fi
2523

@@ -32,7 +30,7 @@ if [[ "$NODE_TYPE" = "primary" ]]; then
3230
--committee $COMMITTEE_PATH \
3331
--store "/validators/validator-$VALIDATOR_ID/db-primary" \
3432
--parameters $PARAMETERS_PATH \
35-
primary $CONSENSUS_DISABLED >> "/home/logs/log-primary.txt" 2>&1
33+
primary $CONSENSUS_DISABLED
3634
elif [[ "$NODE_TYPE" = "worker" ]]; then
3735
echo "Bootstrapping new worker node with id $WORKER_ID"
3836

@@ -41,8 +39,8 @@ elif [[ "$NODE_TYPE" = "worker" ]]; then
4139
--committee $COMMITTEE_PATH \
4240
--store "/validators/validator-$VALIDATOR_ID/db-worker-$WORKER_ID" \
4341
--parameters $PARAMETERS_PATH \
44-
worker --id $WORKER_ID >> "/home/logs/log-worker-$WORKER_ID.txt" 2>&1
42+
worker --id $WORKER_ID
4543
else
4644
echo "Unknown provided value for parameter: NODE_TYPE=$NODE_TYPE"
4745
exit 1
48-
fi
46+
fi

narwhal/Docker/scripts/gen.compose.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
gateway:
155155
image: nginx:latest
156156
depends_on:
157-
- loki
157+
- read
158158
entrypoint:
159159
- sh
160160
- -euc

0 commit comments

Comments
 (0)