--- title: 'CatBus: logging' subtitle: easy low-configuration logging date: 2020-02-20 --- {% extends 'templates/base.html' %} {% block body %}

{{ title }}

{{ subtitle }}

{% markdown %} Using the MQTT bus as a unified system with a unified semantic naming scheme means that I can also implement logging without the need for much configuration. Following the above scheme, we can automatically scrape all devices named `*-sensor` into Prometheus metrics: ``` $control{zone=$zone,device=$device} = $value ``` For example, ``` temperature_celsius{zone=bedroom,device=window-sensor} = 17 ``` Likewise, we can export enums as: ``` home/zone/device/control_enum: foo home/zone/device/control_enum/values: bar foo control{zone=,device=,value=bar} = 0 control{zone=,device=,value=foo} = 1 ``` {% endmarkdown %}
{% endblock %}