Write to a file using middleware JS


Is there a way to write a log to a custom file on the server using the middleware JS plugin


Hi Prashanth,

I’m afraid not - there’s a security concern there… It would need to be a pretty heavily monitored API if we did add it.

What’s your use case?


The use case is basically trace routing.

To do anything with logging the initial trace, we’d like to write to a log file and pull from it into zipkin.
The current log function in tyk logs to stdout or upstart where the rest of the logs are written as well.


You can hook up Sentry at the moment for the logger, we use this library:

It has support for a bunch of external loggers. You could extend Tyk to use another hook (that’s how we support Sentry).