Set up logs with Aidbox project
This guide explains how logging can be activated with the Aidbox project
Last updated
This guide explains how logging can be activated with the Aidbox project
Last updated
We expect your is set up and running.
There are appenders in Aidbox to process log messages. Appender is a processing pipeline which:
Filters logs according to appender's rules
Transforms logs according to appender's rules
Delivers logs to the desired log destination
Each appender has independent set of filters and transformers.
You can think of appenders as of streams that preprocess logs and deliver log messages.
To attach an appender:
Define the appender in Aidbox configuration
Connect the appender as Aidbox service
More detailed appenders information can be found in tech reference section.
Stdout-appender directs the logs stream to the standard output (stdout). Stdout appender sample configuration.
This appenders directs the stream of logs to the Elasticsearch instance. Elasticsearch appender sample configuration.
This appenders directs the stream of logs to the OpenTelemetry Collector. OpenTelemetry appender sample configuration.
In this configuration two appenders (stdout and Elasticsearch) are defined and attached as Aidbox services.
When configuration is ready run Aidbox and login to the Aidbox UI.
Perform REST request
Click the REST Console
menu item in the left sidebar
Press the Send
button
Perform SQL request
Click the DB Console
menu item in the left sidebar
Enter sql statement select pg_sleep(0)
Press the green button
Enter sql statement select pg_sleep(1)
Press the green button
In the terminal you should see a lot of lines like those below.
The same set of lines is sent to Elasticsearch
Transformations is the tool to filter and alter log messages.
The full list of supported transformations can be found in the technical reference.
To remove http requests and responses messages from the stdout logs use aidbox.log/ignore
transformation.
Updated snippet
Logs output
There are fewer lines in the output.
Keep in mind Elasticsearch still receives logs without omissions
To remove fast SQL queries from logs define the transformer and apply it to the appender.
This transformation does two things:
Filter the log message out if the d
(duration) property is less than 100 (milliseconds). Only slow queries appear
Takes 20 first chars from the sql
statement
Updated snipped
Logs output
There is only one line related to the SQL. It is there since the query was slow. Elasticsearch still receives all logs without omissions and transformations.
This tutorial explained:
What log appenders are
How to activate logs with Aidbox configuration
What transformers can be used to ignore log types entirely
How transformer is useful to filter log conditionally and alter the log message according to business rules
Restart Aidbox and we perform to issue log messages.