-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# JSON Log Example | ||
|
||
RabbitMQ 3.9 switched from [Lager](https://github.com/erlang-lager/lager) to the new Erlang [Logger API](https://erlang.org/doc/man/logger.html) supporting JSON-formatted messages. | ||
|
||
Pull Requests: | ||
* [Switch from Lager to the new Erlang Logger API for logging #2861](https://github.com/rabbitmq/rabbitmq-server/pull/2861) | ||
* [Logging: Add configuration variables to set various formats #2927](https://github.com/rabbitmq/rabbitmq-server/pull/2927) | ||
|
||
This example configures RabbitMQ to output JSON logs. | ||
|
||
You can deploy this example like this: | ||
|
||
```shell | ||
kubectl apply -f rabbitmq.yaml | ||
``` | ||
|
||
And once deployed, you can see the JSON logs: | ||
|
||
```shell | ||
kubectl logs json-server-0 -c rabbitmq | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: rabbitmq.com/v1beta1 | ||
kind: RabbitmqCluster | ||
metadata: | ||
name: json | ||
spec: | ||
# JSON logging is supported from RabbitMQ 3.9 onwards | ||
image: rabbitmq:3.9-management | ||
rabbitmq: | ||
# Disable RABBITMQ_LOGS=- which is set in | ||
# https://github.com/docker-library/rabbitmq/blob/ece63d4534cc44abd6b1ec35bbd9aa0d21e87e1d/3.9/ubuntu/Dockerfile#L211 | ||
# Otherwise, this environment variable will override all log configurations in additionalConfig. | ||
envConfig: | | ||
RABBITMQ_LOGS="" | ||
# More log configuration options can be found in https://github.com/rabbitmq/rabbitmq-server/pull/2927 | ||
additionalConfig: | | ||
log.console = true | ||
log.console.level = debug | ||
log.console.formatter = json | ||
log.console.formatter.json.field_map = level time msg domain file line pid | ||
log.console.formatter.time_format = rfc3339_T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
kubectl logs json-server-0 -c rabbitmq --tail=3 | jq . |