Releases: tkuchiki/alp
Releases · tkuchiki/alp
v1.0.21
Add --format json
option.
$ alp json --file example/logs/json_access.log --format json
[["count","1xx","2xx","3xx","4xx","5xx","method","uri","min","max","sum","avg","p90","p95","p99","stddev","min_body","max_body","sum_body","avg_body"],[1,0,1,0,0,0,"POST","/hoge/piyo",0.234,0.234,0.234,0.234,0.234,0.234,0.234,0,34,34,34,34],[1,0,1,0,0,0,"GET","/diary/entry/1234",0.135,0.135,0.135,0.135,0.135,0.135,0.135,0,15,15,15,15],[1,0,1,0,0,0,"GET","/diary/entry/5678",0.432,0.432,0.432,0.432,0.432,0.432,0.432,0,30,30,30,30],[1,0,0,0,0,1,"GET","/foo/bar/5xx",60,60,60,60,60,60,60,0,15,15,15,15],[1,0,1,0,0,0,"GET","/req",0.321,0.321,0.321,0.321,0.321,0.321,0.321,0,15,15,15,15],[2,0,2,0,0,0,"GET","/foo/bar",0.123,0.123,0.246,0.123,0.123,0.123,0.123,0,56,56,112,56],[5,0,5,0,0,0,"POST","/foo/bar",0.057,0.234,0.548,0.11,0.234,0.234,0.234,0.065,12,34,126,25.2]]
$ alp json count --file example/logs/json_access.log --keys ua --format json
[["sum","ua"],[1,"UA4"],[3,"UA2"],[4,"UA1"],[4,"UA3"]]
$ alp json topN --file example/logs/json_access.log --format json
[["rank","uri","method","status","restime","bytes","time"],[1,"/foo/bar?token=xxx\u0026uuid=1234","POST",200,0.057,12,"2015-09-06T05:58:05+09:00"],[2,"/foo/bar?token=xxx\u0026uuid=1234","POST",200,0.057,12,"2015-09-06T05:58:05+09:00"],[3,"/foo/bar?token=yyy","POST",200,0.1,34,"2015-09-06T05:58:41+09:00"],[4,"/foo/bar?token=yyy","POST",200,0.1,34,"2015-09-06T05:58:41+09:00"],[5,"/foo/bar?token=zzz","GET",200,0.123,56,"2015-09-06T06:00:42+09:00"],[6,"/foo/bar?token=zzz","GET",200,0.123,56,"2015-09-06T06:00:42+09:00"],[7,"/diary/entry/1234","GET",200,0.135,15,"2015-09-06T06:00:43+09:00"],[8,"/foo/bar?token=yyy","POST",200,0.234,34,"2015-09-06T05:58:44+09:00"],[9,"/hoge/piyo?id=yyy","POST",200,0.234,34,"2015-09-06T05:58:44+09:00"],[10,"/req","GET",200,0.321,15,"2015-09-06T06:00:43+09:00"],[11,"/diary/entry/5678","GET",200,0.432,30,"2015-09-06T06:00:43+09:00"],[12,"/foo/bar/5xx","GET",504,60,15,"2015-09-06T06:00:43+09:00"]]
Changelog
v1.0.20
v1.0.19
Add (json|ltsv|regexp|pcap) topN
command
$ alp json topN --file example/logs/json_access.log -r
+----+------------------------------+--------+--------+---------------+------------+---------------------------+
| | URI | METHOD | STATUS | RESPONSE TIME | BODY BYTES | TIME |
+----+------------------------------+--------+--------+---------------+------------+---------------------------+
| 1 | /foo/bar/5xx | GET | 504 | 60.000 | 15.000 | 2015-09-06T06:00:43+09:00 |
| 2 | /diary/entry/5678 | GET | 200 | 0.432 | 30.000 | 2015-09-06T06:00:43+09:00 |
| 3 | /req | GET | 200 | 0.321 | 15.000 | 2015-09-06T06:00:43+09:00 |
| 4 | /foo/bar?token=yyy | POST | 200 | 0.234 | 34.000 | 2015-09-06T05:58:44+09:00 |
| 5 | /hoge/piyo?id=yyy | POST | 200 | 0.234 | 34.000 | 2015-09-06T05:58:44+09:00 |
| 6 | /diary/entry/1234 | GET | 200 | 0.135 | 15.000 | 2015-09-06T06:00:43+09:00 |
| 7 | /foo/bar?token=zzz | GET | 200 | 0.123 | 56.000 | 2015-09-06T06:00:42+09:00 |
| 8 | /foo/bar?token=zzz | GET | 200 | 0.123 | 56.000 | 2015-09-06T06:00:42+09:00 |
| 9 | /foo/bar?token=yyy | POST | 200 | 0.100 | 34.000 | 2015-09-06T05:58:41+09:00 |
| 10 | /foo/bar?token=yyy | POST | 200 | 0.100 | 34.000 | 2015-09-06T05:58:41+09:00 |
| 11 | /foo/bar?token=xxx&uuid=1234 | POST | 200 | 0.057 | 12.000 | 2015-09-06T05:58:05+09:00 |
| 12 | /foo/bar?token=xxx&uuid=1234 | POST | 200 | 0.057 | 12.000 | 2015-09-06T05:58:05+09:00 |
+----+------------------------------+--------+--------+---------------+------------+---------------------------+
$ alp json topN 5 --file example/logs/json_access.log -r
+---+--------------------+--------+--------+---------------+------------+---------------------------+
| | URI | METHOD | STATUS | RESPONSE TIME | BODY BYTES | TIME |
+---+--------------------+--------+--------+---------------+------------+---------------------------+
| 1 | /foo/bar/5xx | GET | 504 | 60.000 | 15.000 | 2015-09-06T06:00:43+09:00 |
| 2 | /diary/entry/5678 | GET | 200 | 0.432 | 30.000 | 2015-09-06T06:00:43+09:00 |
| 3 | /req | GET | 200 | 0.321 | 15.000 | 2015-09-06T06:00:43+09:00 |
| 4 | /foo/bar?token=yyy | POST | 200 | 0.234 | 34.000 | 2015-09-06T05:58:44+09:00 |
| 5 | /hoge/piyo?id=yyy | POST | 200 | 0.234 | 34.000 | 2015-09-06T05:58:44+09:00 |
+---+--------------------+--------+--------+---------------+------------+---------------------------+
Changelog
v1.0.18
v1.0.17
- [bugfix] Fix
--config
option incorrect overwrite behavior
v1.0.16 behavior as follows:
# config file
percentiles:
- 99
$ alp json --config /tmp/config.yaml --file example/logs/json_access.log
+-------+-----+-----+--------+--------+--------+--------+-----------+-----------+-----------+-----------+
| COUNT | 1XX | ... | P99 | P95 | P99 | STDDEV | MIN(BODY) | MAX(BODY) | SUM(BODY) | AVG(BODY) |
+-------+-----+-----+--------+--------+--------+--------+-----------+-----------+-----------+-----------+
| 1 | 0 | ... | 0.234 | 0.234 | 0.234 | 0.000 | 34.000 | 34.000 | 34.000 | 34.000 |
| 1 | 0 | ... | 0.135 | 0.135 | 0.135 | 0.000 | 15.000 | 15.000 | 15.000 | 15.000 |
| 1 | 0 | ... | 0.432 | 0.432 | 0.432 | 0.000 | 30.000 | 30.000 | 30.000 | 30.000 |
| 1 | 0 | ... | 60.000 | 60.000 | 60.000 | 0.000 | 15.000 | 15.000 | 15.000 | 15.000 |
| 1 | 0 | ... | 0.321 | 0.321 | 0.321 | 0.000 | 15.000 | 15.000 | 15.000 | 15.000 |
| 2 | 0 | ... | 0.123 | 0.123 | 0.123 | 0.000 | 56.000 | 56.000 | 112.000 | 56.000 |
| 5 | 0 | ... | 0.234 | 0.234 | 0.234 | 0.065 | 12.000 | 34.000 | 126.000 | 25.200 |
+-------+-----+-----+--------+--------+--------+--------+-----------+-----------+-----------+-----------+
Changelog
v1.0.16
v1.0.15
v1.0.14
v1.0.13
{"time":"2015-09-06T05:58:05+09:00","method":"POST","uri":"/foo/bar?token=xxx&uuid=1234","status":200,"body_bytes":12,"response_time":0.057,"ua":"chrome","host":"192.168.1.100"}
{"time":"2015-09-06T05:58:41+09:00","method":"POST","uri":"/foo/bar?token=yyy","status":200,"body_bytes":34,"response_time":0.100,"ua":"chrome","host":"192.168.1.100"}
{"time":"2015-09-06T06:00:42+09:00","method":"GET","uri":"/foo/bar?token=zzz","status":200,"body_bytes":56,"response_time":0.123,"ua":"firefox","host":"192.168.1.100"}
{"time":"2015-09-06T05:58:44+09:00","method":"POST","uri":"/foo/bar?token=yyy","status":200,"body_bytes":34,"response_time":0.234,"ua":"firefox","host":"192.168.1.110"}
{"time":"2015-09-06T05:58:44+09:00","method":"POST","uri":"/hoge/piyo?id=yyy","status":200,"body_bytes":34,"response_time":0.234,"ua":"firefox","host":"192.168.1.111"}
{"time":"2015-09-06T05:58:05+09:00","method":"POST","uri":"/foo/bar?token=xxx&uuid=1234","status":200,"body_bytes":12,"response_time":0.057,"ua":"edge","host":"192.168.1.120"}
{"time":"2015-09-06T05:58:41+09:00","method":"POST","uri":"/foo/bar?token=yyy","status":200,"body_bytes":34,"response_time":0.100,"ua":"edge","host":"192.168.1.120"}
{"time":"2015-09-06T06:00:42+09:00","method":"GET","uri":"/foo/bar?token=zzz","status":200,"body_bytes":56,"response_time":0.123,"ua":"edge","host":"192.168.1.120"}
{"time":"2015-09-06T06:00:43+09:00","method":"GET","uri":"/diary/entry/1234","status":200,"body_bytes":15,"response_time":0.135,"ua":"chrome","host":"192.168.1.101"}
{"time":"2015-09-06T06:00:43+09:00","method":"GET","uri":"/diary/entry/5678","status":200,"body_bytes":30,"response_time":0.432,"ua":"chrome","host":"192.168.1.100"}
{"time":"2015-09-06T06:00:43+09:00","method":"GET","uri":"/foo/bar/5xx","status":504,"body_bytes":15,"response_time":60.000,"ua":"chrome","host":"192.168.1.101"}
$ cat access.log | alp count --keys ua,host
+-----+---------+---------------+
| SUM | UA | HOST |
+-----+---------+---------------+
| 1 | firefox | 192.168.1.100 |
| 1 | firefox | 192.168.1.110 |
| 1 | firefox | 192.168.1.111 |
| 2 | chrome | 192.168.1.101 |
| 3 | chrome | 192.168.1.100 |
| 3 | edge | 192.168.1.120 |
+-----+---------+---------------+
$ cat access.log | alp count --keys ua,host -r
+-----+---------+---------------+
| SUM | UA | HOST |
+-----+---------+---------------+
| 3 | chrome | 192.168.1.100 |
| 3 | edge | 192.168.1.120 |
| 2 | chrome | 192.168.1.101 |
| 1 | firefox | 192.168.1.100 |
| 1 | firefox | 192.168.1.110 |
| 1 | firefox | 192.168.1.111 |
+-----+---------+---------------+