evenh / webhook-router

Receive webhooks on your LAN
MIT License
1 stars 2 forks source link

Log to file #2

Open ivanskodje opened 5 years ago

ivanskodje commented 5 years ago

Jenkins returns OK (200) status even if it cannot find any jobs, perhaps due to lacking permissions. The router should also log the response messages.

Webhook Router would benefit from being able to write logs to a file, instead of directly to the command prompt (assuming you run it manually). Otherwise we have no way of knowing (to my knowledge) what is going on with the webhook router.

evenh commented 5 years ago

Logging could absolutely be improved. I don't know if all request should be logged (since it may contain sensitive data that the router should not know about). One could default to log erroneous HTTP response? Or introduce a configuration option to optionally log a specific routing.

I however disagree that it should log to a file. I am a supporter of The Twelve-Factor App school of thought. On logs:

[…] A twelve-factor app never concerns itself with routing or storage of its output stream. It should not attempt to write to or manage logfiles. Instead, each running process writes its event stream, unbuffered, to stdout. During local development, the developer will view this stream in the foreground of their terminal to observe the app’s behavior.

In staging or production deploys, each process’ stream will be captured by the execution environment, collated together with all other streams from the app, and routed to one or more final destinations for viewing and long-term archival. These archival destinations are not visible to or configurable by the app, and instead are completely managed by the execution environment. Open-source log routers (such as Logplex and Fluentd) are available for this purpose.

The event stream for an app can be routed to a file, or watched via realtime tail in a terminal. Most significantly, the stream can be sent to a log indexing and analysis system such as Splunk, or a general-purpose data warehousing system such as Hadoop/Hive. […]