The default log format evolved slightly from this:
[2024-02-06T14:54:11Z INFO actix_server::builder] starting 10 workers
To this:
2024-02-06T13:58:14.710803Z INFO actix_server::builder: 200: starting 10 workers
It’s pretty much the same, the only information added is the line number that generated this log.
Introduce 3 new routes and one new CLI parameter:
POST /logs/stream
Stream the log happening in real time to you. Requires the metrics.get
API key action, and takes two parameters:
target
to select what logs you’re interested into. It takes the form of code_part=log_level
. For example index_scheduler=info
mode
to select in what format of log you want, currently only two modes are available:
human
same as the logs you see in the console
json
contains the same information as the human
logs but formatted in json objects
profile
a way more complexe trace that gives informations on the time spent in every function + the RAM consumption.
The output of this route is not human readable, to read it you’ll need to use a dedicated binary located in the meilisearch repository and called trace-to-firefox
and finally open the output of this program in the firefox profiler
⚠️ Some remarks on this route ⚠️ :
xh
or httpie
Example usage:
curl \\
-X POST <http://localhost:7700/logs/stream> \\
-H 'Content-Type: application/json' \\
--data-binary '{
"mode": "human",
"target": "milli=trace"
}'
DELETE /logs/stream
Stops the listener from the meilisearch perspective. Requires the metrics.get
api key action and takes no parameter. Usage:
curl \\
-X DELETE <http://localhost:7700/logs>
POST /logs/stderr
Lets you update the log level used in the console. Takes one parameter and requires the metrics.get
API key action:
target
same as the target of the stream
routeAnd one new CLI parameter is introduced; it’s called: experimental_logs_mode
and lets you specify the log format you want to use on the console.
Accepted values are:
human
: the default human-readable onejson
: json structured logs