diff --git a/docs/configuration.md b/docs/configuration.md index 69ef1c94..36202b69 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -434,6 +434,7 @@ imgproxy can report occurred errors to Bugsnag, Honeybadger and Sentry: * `pretty`: _(default)_ colored human-readable format * `structured`: machine-readable format * `json`: JSON format + * `gcp`: Google Cloud Logging agent compliant * `IMGPROXY_LOG_LEVEL`: the log level. The following levels are supported `error`, `warn`, `info` and `debug`. Default: `info` imgproxy can send logs to syslog, but this feature is disabled by default. To enable it, set `IMGPROXY_SYSLOG_ENABLE` to `true`: diff --git a/logger/log.go b/logger/log.go index f7d7c632..02ba9926 100644 --- a/logger/log.go +++ b/logger/log.go @@ -23,6 +23,13 @@ func Init() error { logrus.SetFormatter(&structuredFormatter{}) case "json": logrus.SetFormatter(&logrus.JSONFormatter{}) + case "gcp": + logrus.SetFormatter(&logrus.JSONFormatter{ + FieldMap: logrus.FieldMap{ + "level": "severity", + "msg": "message", + }, + }) default: logrus.SetFormatter(newPrettyFormatter()) }