What's the best way to add custom logging format?

System Information
  • Strapi Version: 3.6.5
  • Operating System: macOS/Linux
  • Database: sqlite/postgres
  • Node Version: 14.16.1
  • NPM Version: 6.14.12
  • Yarn Version: n/a

Hey everyone!

To put a little bit into context, we need Strapi logs to be in json format and have different property names. (For example: message instead of msg and @timestamp instead of time). Also, we would like to have UTC time instead of UNIX time.

This is because our infrastructure need the logs to be in a very specific format.

We were thinking about a middleware, or maybe we need to create a PR to add a Pino formatter to the source code. What do you think? What is the best approach?

I can provide more info later is needed.

Thanks so much!

1 Like

I’m also looking to do this. We use Splunk to view our logs and currently because the Strapi instance isn’t using a standard logging format, it is very difficult to create a custom Splunk logging format that fits all the log patterns that the Strapi instance is logging.