log-http2file

0.2.0 • Public • Published

Log-HTTP2File

Simple HTTP server to log POST request content to file

Homepage: https://github.com/fabrom/log-http2file
Report bugs on https://github.com/fabrom/log-http2file/issues

Requirements

Installation

npm install log-http2file

To download a zip, go to the Log-HTTP2File on Github

Usage

  Usage: log-http2file [options] <outputfile>
  
  Simple HTTP server to log POST request content to file
 
  Options:
 
    -h, --help         output usage information
    -V, --version      output the version number
    -w, --workers <n>  how many listening workers
    -p, --port <n>     listening port

Starting server

./log-http2file [options] output_file_path

Look at forever tool for running this server in production.

Options
  • -w workers count (default=(CPUs/2)+1)
  • -p listening port (default=8142)

Log rotation

SIGHUP signal stop workers, rename current log file with adding current datetime and start new workers.
Example : x.log will be renamed to x_201605281900.log

Stopping server

Ctrl+C on console mode, SIGINT, SIGTERM or SIGBREAK signals will stop workers and main process.

Sending client log entries

Send simple HTTP POST request to the server.

Example :

curl -X POST \
     --data "This line will be write in the output file open by the Log-HTTP2File server" \
     --header "Content-Type:text/plain" \
      http://localhost:8142

Monitoring log

You should look at log.io for log monitoring.

License

Log-HTTP2File is available under the MIT license.

Package Sidebar

Install

npm i log-http2file

Weekly Downloads

2

Version

0.2.0

License

MIT

Last publish

Collaborators

  • fabrom