Skip to content

Commit

Permalink
Merge pull request #18 from zeeshanakram3/logging_documentation
Browse files Browse the repository at this point in the history
Add documentation to view docker logs
  • Loading branch information
zeeshanakram3 authored Feb 22, 2024
2 parents d3ce6c1 + afdf4f7 commit c4e6fd3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,25 @@ The Joystream Storage-Squid is a [Subsquid](https://docs.subsquid.io/) based pro
make prepare # install dependencies and build the project
make up-squid # start the storage-squid processor and the GraphQL server
```

## Logging

The storage-squid uses the `@subsquid/logger` package for logging. The logger is configured to log to `stderr` and the log level is determined by the `SQD_*` environment variables.

By default, the log level for Storage Squid processor is set to `SQD_DEBUG=sqd:processor:mapping`. This means that all loggers will log at `DEBUG` level. So the processor logs will contain `DEBUG`, `INFO`, `WARN`, `ERROR` and `FATAL` logs (The integer values for these logging levels are `1`, `2`, `3`, `4` and `5` respectively).

However, sometimes it is very difficult to analyze the processor logs because of the high volume of DEBUG logs. So maybe you only want to see `INFO`, `WARN`, `ERROR` and `FATAL` logs. You can do this by using the `docker logs ...` command in the following way

```bash
# Only INFO logs
docker logs squid_processor 2>&1 | grep -E "\"level\":2"

# INFO and above logs
docker logs squid_processor -f 2>&1 | grep -E "\"level\":2|\"level\":3|\"level\":4|\"level\":5"

# You can also use other docker logs options like --follow, --tail etc
docker logs squid_processor --follow --tail 100 2>&1 | grep -E "\"level\":2|\"level\":3|\"level\":4|\"level\":5"

# In case you only want to see the logs of a specific logger namespace e.g sqd:processor, you can use the following command.
docker logs squid_processor -f 2>&1 | grep -E "\"sqd:processor"\"
```

0 comments on commit c4e6fd3

Please sign in to comment.