Seq is a log aggregation tool that's perfect for browsing logs during local development.
You can see a full example of using Batect with Seq in the Seq sample project.
You can launch an instance of Seq with the following Batect configuration:
This simple configuration has a flaw explained below.
This will make the Seq UI available at http://localhost:9000 on your local machine, and allows submitting logs to Seq using the GELF protocol on UDP port 12201.
You can combine this with Docker's GELF log driver to automatically send logs from your application to Seq. For example, to send
all logs from the
app container to Seq:
Docker does not support streaming logs to the console when using the GELF log driver. Instead, you'll receive an error message such
Error attaching: configured logging driver does not support reading.
This does not affect the operation of your containers, only the ability to see the output in the console.
If you use the configuration above, depending on how quickly your application starts, you may lose some of the first log messages it emits.
The solution to this is to specify a healthcheck for the Seq container. For example, you can replace the image with this Dockerfile to add a healthcheck:
And then reference that Dockerfile (saved as
.batect/seq/Dockerfile) in your Batect configuration: