mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
126 stars 41 forks source link

Use mozlog logging format to get access to server logs #10231

Closed jasonthomas closed 6 years ago

jasonthomas commented 7 years ago

https://wiki.mozilla.org/Firefox/Services/Logging contains a description about the mozlog format. Switching to mozlog will help get addons-frontend hooked up to Logging 2.0 https://mana.mozilla.org/wiki/display/SVCOPS/Logging+2.0

kumar303 commented 7 years ago

Seems doable. We use bunyan (which already supports JSON) so maybe we can hook it up to mozlog.

kumar303 commented 7 years ago

This is high-ish priority. I'm putting it in the London Work Week milestone but anyone should feel free to grab it before then.

kumar303 commented 6 years ago

We need to do this if we want to see logs in the [new Kibana](https://amo-kibana.prod.mozaws.net/_plugin/kibana/app/kibana#/discover?_g=()&_a=(columns:!(_source),index:'amo*',interval:auto,query:(match_all:()),sort:!(Timestamp,desc))). The old one is still active but won't be around for much longer.

willdurand commented 6 years ago

I have a PR for switching to pino (#5826) and a pino transport almost ready :)

Mozlog is a no-go however... It is a complete logger that leverages an older logger (intel) without a way to use their formatter...

willdurand commented 6 years ago

See: https://github.com/willdurand/pino-mozlog (WIP/quick & dirty)

To try it:

diff --git a/package.json b/package.json
index 180016305..9546d0829 100644
--- a/package.json
+++ b/package.json
@@ -95,7 +95,7 @@
       }
     },
     "start-dev": {
-      "command": "npm run clean && concurrently --kill-others 'npm run webpack-dev-server' 'node bin/server.js | pino'",
+      "command": "npm run clean && concurrently --kill-others 'npm run webpack-dev-server' 'node bin/server.js | pino-mozlog'",
       "env": {
         "ENABLE_PIPING": "true",
         "NODE_ENV": "development",
@@ -104,7 +104,7 @@
       }
     },
     "start-dev-proxy": {
-      "command": "npm run clean && concurrently --kill-others 'npm run webpack-dev-server' 'node bin/server.js | pino' 'node bin/proxy.js | pino'",
+      "command": "npm run clean && concurrently --kill-others 'npm run webpack-dev-server' 'node bin/server.js | pino-mozlog' 'node bin/proxy.js | pino-mozlog --type proxy'",
       "env": {
         "ENABLE_PIPING": "true",
         "NODE_ENV": "development",

Now, start yarn amo:dev and you should see the mozlog logs.