Skip to content

Instantly share code, notes, and snippets.

@ajpen
Last active February 27, 2017 15:16
Show Gist options
  • Select an option

  • Save ajpen/3f0789cf68d1c67906fa5f529b8dfa72 to your computer and use it in GitHub Desktop.

Select an option

Save ajpen/3f0789cf68d1c67906fa5f529b8dfa72 to your computer and use it in GitHub Desktop.
Things observed when writing visorlog
  • Docker containers can only communicate with the host using the docker0 interface address, which from my understanding is the network bridge. The cleanest way of doing this is through the 'hosts' file. the IP can be taken running this command on a linux host: ip route list dev docker0 | awk 'NR==1 {print $NF}'. If it does not work, changing NR==1 to NR==2 may do the job. This can be added as an ENV variable for easily access. To add a new entry to the hosts file you need to add the --add-host= argument to your docker run command. e.g. docker run --add-host=hostip:$DOCKER_HOST_IP...

Python logging using YAML configuration is greatly limited. Its better to use the dict config if you wish to support custom handlers, etc. the YAML config can only get handlers that are in the current namespace. Which means, if you want to use any of the typical python handlers, you need to do import logging.handlers in the module that configures the logging from the YAML file which sucks. Use the dict config!

  • The above was proven wrong. I was able to use my custom handler from an external file just by specifying it in the file configuration:
  [handler_hand01]
  class=graypython.GraylogHTTPGelfHandler
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment