javascriptnode.jsexpressexpress-gateway

Express Gateway enabling logs


I have below issues with Express Gateway logs:

  1. I have enabled Express Gateway logs according to their documentation, but I couldn't find any log file created under my gateway root.
  2. When I start the gateway with below command it shows debug logs, but the changes that I do in gateway.config.yml config will not reflect in debug log.

    LOG_LEVEL=debug npm start

  3. How do I add timestamp for the log entries?

Edited:

gateway.config.yml config values:

pipelines: default: apiEndpoints: - api policies: - log: # policy name - action: # array of condition/actions objects #timestamp: true message: Test ${req.method} ${req.originalUrl} # parameter for log action # Uncommentkey-auth:when instructed to in the Getting Started guide. - key-auth: - proxy: - action: serviceEndpoint: httpbin changeOrigin: true


Solution

    1. Express Gateway has no way to store logs on files. While this is technically possible (We're using Winston under the hood so we would just need to put the right transport strategy) we haven't provided a way to enable it. Right now you'd need to catch the log from the standard output and save them somewhere, using IO redirection in case you're on an UNIX system.

    2. I'm not quite sure what you mean here. When you're doing some changes to the gateway.config file you should receive an info message telling you the hot reloading has completed. If you can elaborate more I can be more precise here

    3. Unfortunately you can't. Our logging strategy is not exactly THAT configurable. It might be worth to open an issue on our repository so we can prioritize these requests.

    Thanks,

    V.