hapijs / good

hapi process monitoring
Other
525 stars 160 forks source link

No log events showing in response event after upgrading to Good 7 #542

Closed andersjanmyr closed 7 years ago

andersjanmyr commented 7 years ago

My log events don't show up in the response event after I upgraded to Good 7.1.0. I have also upgrade to Hapi 16.1.0.

Perhaps my configuration is wrong, but I have checked it over and over and I can't figure it out. The response.log grouping is my favorite feature of Good and I would sure miss it if it's gone. Any help would be greatly appreciated.

The logs show the individual request events, but the response.log is empty.

Here's the config and the log events follow.

  good: {
      ops: { 'interval': 5000},
      includes: {
        request: ['headers', 'payload'],
        response: ['payload']
      },
      responseEvent: 'tail',
      reporters: {
        file: [
          {
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{ log: '*', request: '*', response: '*', error: '*', ops: '*' }]
          },
          {
            module: require('../../lib/log-filter'),
            args: [['password']]
          },
          {
            module: 'good-squeeze',
            name: 'SafeJson'
          },
          {
            module: 'good-file',
            args: ['/var/log/samsxci/server.log']
          }
        ]
}
{"event":"request","timestamp":1490319886064,"tags":["dingo"],"data":"dong","pid":92527,"id":"1490319886053:m-C02RN22XG8WM.local:92527:j0n5yoee:10000","method":"post","path":"/v2/users/login","config":{}}
{"event":"request","timestamp":1490319886066,"tags":["options"],"data":{"username":"test5126044780@email.com","password":"XXXXXXX"},"pid":92527,"id":"1490319886053:m-C02RN22XG8WM.local:92527:j0n5yoee:10000","method":"post","path":"/v2/users/login","config":{}}
{"event":"response","timestamp":1490319886053,"id":"1490319886053:m-C02RN22XG8WM.local:92527:j0n5yoee:10000","instance":"http://0.0.0.0:8080","labels":[],"method":"post","path":"/v2/users/login","query":{},"responseTime":873,"responseSentTime":872,"statusCode":200,"pid":92527,"httpVersion":"1.1","source":{"remoteAddress":"127.0.0.1","userAgent":"curl/7.51.0"},"route":"/v2/users/login","log":[],"headers":{"host":"0.0.0.0:8080","user-agent":"curl/7.51.0","accept":"*/*","content-type":"application/json","cache-control":"no-cache","postman-token":"a7f20b54-572e-350d-b903-f8621a72195a","content-length":"70"},"requestPayload":{"username":"test5126044780@email.com","password":"XXXXXXX"},"responsePayload":{"status":0,"data":{"username":"test5126044780@email.com"}},"config":{}}
arb commented 7 years ago

I'm not sure what issue you are having? What isn't working?

andersjanmyr commented 7 years ago

The third event, response, used to get the request events aggregated into its log property. (Spaces added for clartity). I don't see them anymore. I upgraded from Good 6.1.4.

{"event":"response","timestamp":1490319886053,"id":"1490319886053:m-C02RN22XG8WM.local:92527:j0n5yoee:10000","instance":"http://0.0.0.0:8080","labels":[],"method":"post","path":"/v2/users/login","query":{},"responseTime":873,"responseSentTime":872,"statusCode":200,"pid":92527,"httpVersion":"1.1","source":{"remoteAddress":"127.0.0.1","userAgent":"curl/7.51.0"},"route":"/v2/users/login","log":[

{"event":"request","timestamp":1490319886064,"tags":["dingo"],"data":"dong","pid":92527,"id":"1490319886053:m-C02RN22XG8WM.local:92527:j0n5yoee:10000","method":"post","path":"/v2/users/login","config":{}},
{"event":"request","timestamp":1490319886066,"tags":["options"],"data":{"username":"test5126044780@email.com","password":"XXXXXXX"},"pid":92527,"id":"1490319886053:m-C02RN22XG8WM.local:92527:j0n5yoee:10000","method":"post","path":"/v2/users/login","config":{}}

],"headers":{"host":"0.0.0.0:8080","user-agent":"curl/7.51.0","accept":"*/*","content-type":"application/json","cache-control":"no-cache","postman-token":"a7f20b54-572e-350d-b903-f8621a72195a","content-length":"70"},"requestPayload":{"username":"test5126044780@email.com","password":"XXXXXXX"},"responsePayload":{"status":0,"data":{"username":"test5126044780@email.com"}},"config":{}}
arb commented 7 years ago

https://github.com/hapijs/good/blob/master/lib/utils.js#L83-L85

Looks like there was a change in this area in hapi. Try fiddling with the route settings.

andersjanmyr commented 7 years ago

@arb Thanks a lot, you solved it! :)

The following configuration enabled the aggregated events again.

const server = new Hapi.Server({ connections: { routes: { log: true } } });
lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.