Skip to content

Count and output sent http status code using mruby code.

Notifications You must be signed in to change notification settings

yano3/http-status-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 

Repository files navigation

http-status-counter

Count and output sent http status code using mruby code.

Configuration

nginx

http {
  mruby_init /path/to/nginx/conf.d/status_counter/status_counter_init.rb cache;

  server {
    location / {
      mruby_log_handler /path/to/nginx/conf.d/status_counter/status_counter.rb cache;
    }

    location /status_count {
      mruby_content_handler /path/to/nginx/conf.d/status_counter/status_counter_output.rb cache;
    }
  }
}
$ curl http://localhost/status_count | jq
{
  "requests": 6218,
  "status": {
    "200": 3344,
    "301": 1192,
    "302": 901,
    "404": 781
  },
  "body_bytes_sent": 5200307169,
  "request_time": 379091,
  "avg_request_time": 61.084822695035,
  "upstream_response_time": 351707,
  "avg_upstream_response_time": 57.210212765957
}

use case

dependent mrbgem

  conf.gem :github => 'matsumotory/mruby-localmemcache'
  conf.gem :github => 'matsumotory/mruby-mutex'
  conf.gem :github => 'mattn/mruby-json'

About

Count and output sent http status code using mruby code.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages