readme.fr

Hot opensource news

How did I set color in my life.

One day I had a bug on OpenStack platform. If I remember well it was a nova problem.

Lucky day for a debug session, all nova logs was in DEBUG level ! But as you may know, when you set this log level in OpenStack services, the output can be really, really, really verbose.

So that night, I wrote a script openstack-log-colorizer

This script is a devops tool written in python. Easy to setup and require only standard python library.

The first idea was to provide live log level filter and feature like log coloration. The script behavior is to parse log format with a regex. Color the line if the regex match, else just display the line without color.

Setup openstack log colorizer :

wget -O /usr/local/bin/openstack_log_colorizer https://raw.githubusercontent.com/gaelL/openstack-log-colorizer/master/openstack_log_colorizer
chmod +x /usr/local/bin/openstack_log_colorizer

Use case : I want display only log greater than or equal to INFO for nova and neutron services.

tail -f /var/log/{nova,neutron}/*.log | openstack_log_colorizer --level info

Expected output :
colored_log

gaelL
gaelL on GithubgaelL on LinkedingaelL on Wordpress

, , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *