André Figueira

Systems engineer - I write apps, I make websites, opinions are my own...

How to Stream Docker logs to your browser!

In this article, I'll be going through how to setup Logio in Docker and get your docker projects logs streaming to your browser using

Caveat: This article assumes you know the basics about Docker, we'll only be covering how to use a Docker logio container and link it to your projects log files

So assuming you're using docker-compose, and a docker-compose.yaml you need to add the following YAML to your docker-compose.yaml

I will be omiting the network configurations, so use what you've got configured for yours!

This configures the web server portion of Logio

    hostname: air-logs
    image: 'blacklabelops/logio:latest'
    # container_name: logio
      - '28778:28778'
      - '/opt/server'

This is the important part, where you can configure your logs, there are many other different options available in this container, but I found for projects which generate logs, this is the most appropriate implementation.

    image: 'blacklabelops/logio:latest'
      - 'DELAYED_START=10'
      - 'LOGIO_HARVESTER1STREAMNAME=WhateverYouWantToNameYourStream' 
      - 'LOGIO_HARVESTER1LOGSTREAMS=/var/log/path-to-logs' 
      - '/var/lib/docker:/var/lib/docker'
      - './log/eagleeye/:/var/log/eagleeye/'
      - logioweb:logio
    user: root
    command: harvester

To get your project logs showing up, it's just a case of adding the following 3 environment variables per project:

  • LOGIO_HARVESTER1STREAMNAME=WhateverYouWantToNameYourStream
  • LOGIO_HARVESTER1LOGSTREAMS=/var/log/path-to-logs

Note the number (1) in each of these, this is because you can create as many streams for Logio as you want, all you need to do, is create the 3 environment variables in your docker-compose.yaml again, and increment that number. e.g.

  • LOGIO_HARVESTER2STREAMNAME=WhateverYouWantToNameYourStream2
  • LOGIO_HARVESTER2LOGSTREAMS=/var/log/path-to-logs

So long as your log files exist when you then go and do a docker-compose up -d it will load up the streams as you've named them, and voila presto! Go to http://localhost:28778 and you should see your logs