Akihito Ikeda

alp

posts/2021-08-18diary

tkuchiki/alp: Access Log Profiler

ISUCONでのボトルネック調査のために使う。

インストール方法から使い方までREADMEにだいたい書いてあって、作者が書いた詳しい紹介記事もある。

基本的には--sort--reverseを使ってボトルネックを探せばよさそう。

ISUCON9予選で初回ベンチを実行後にalpで解析するとこんな感じ。

$ cat /var/log/nginx/access.log | alp ltsv --sort=count -r
+-------+-----+-----+-----+-----+-----+--------+----------------------------------------------+-------+-------+---------+-------+-------+-------+-------+--------+------------+------------+-------------+------------+
| COUNT | 1XX | 2XX | 3XX | 4XX | 5XX | METHOD |                     URI                      |  MIN  |  MAX  |   SUM   |  AVG  |  P90  |  P95  |  P99  | STDDEV | MIN(BODY)  | MAX(BODY)  |  SUM(BODY)  | AVG(BODY)  |
+-------+-----+-----+-----+-----+-----+--------+----------------------------------------------+-------+-------+---------+-------+-------+-------+-------+--------+------------+------------+-------------+------------+
|   128 |   0 | 118 |   0 |  10 |   0 | GET    | /users/transactions.json                     | 0.047 | 5.892 | 354.925 | 2.773 | 5.035 | 5.222 | 5.345 |  1.713 |      0.000 |  24921.000 | 2427774.000 |  18966.984 |
|    97 |   0 |  97 |   0 |   0 |   0 | GET    | /new_items/20.json                           | 0.207 | 2.879 |  82.743 | 0.853 | 1.350 | 1.444 | 2.879 |  0.439 |  23180.000 |  23874.000 | 2286001.000 |  23567.021 |
|    73 |   0 |  73 |   0 |   0 |   0 | GET    | /new_items/10.json                           | 0.275 | 1.449 |  51.799 | 0.710 | 0.998 | 1.077 | 1.449 |  0.217 |  23212.000 |  23993.000 | 1727864.000 |  23669.370 |
|    66 |   0 |  66 |   0 |   0 |   0 | GET    | /new_items.json                              | 0.198 | 2.736 |  67.735 | 1.026 | 1.450 | 1.524 | 2.736 |  0.373 |  22997.000 |  23694.000 | 1544257.000 |  23397.833 |
|    64 |   0 |  64 |   0 |   0 |   0 | GET    | /new_items/40.json                           | 0.205 | 1.473 |  37.137 | 0.580 | 0.985 | 1.091 | 1.473 |  0.299 |  23422.000 |  24004.000 | 1522235.000 |  23784.922 |
|    59 |   0 |  51 |   0 |   8 |   0 | POST   | /login                                       | 0.087 | 1.072 |  29.801 | 0.505 | 1.007 | 1.021 | 1.072 |  0.312 |     73.000 |    107.000 |    5599.000 |     94.898 |
|    56 |   0 |  56 |   0 |   0 |   0 | GET    | /new_items/60.json                           | 0.140 | 1.796 |  37.964 | 0.678 | 1.363 | 1.426 | 1.796 |  0.445 |  22652.000 |  23311.000 | 1289123.000 |  23020.054 |
|    51 |   0 |  51 |   0 |   0 |   0 | GET    | /settings                                    | 0.001 | 0.683 |   5.451 | 0.107 | 0.318 | 0.495 | 0.683 |  0.159 |   2939.000 |   2953.000 |  150161.000 |   2944.333 |
|    43 |   0 |  43 |   0 |   0 |   0 | GET    | /new_items/1.json                            | 0.111 | 1.118 |  23.571 | 0.548 | 0.902 | 0.930 | 1.118 |  0.301 |  22971.000 |  23581.000 |  999635.000 |  23247.326 |
|    40 |   0 |  38 |   0 |   2 |   0 | GET    | /new_items/30.json                           | 0.146 | 1.015 |  17.187 | 0.430 | 0.556 | 0.637 | 1.015 |  0.149 |      0.000 |  23981.000 |  897088.000 |  22427.200 |
|    38 |   0 |  26 |   0 |  12 |   0 | POST   | /sell                                        | 0.001 | 1.067 |   4.805 | 0.126 | 0.496 | 0.619 | 1.067 |  0.221 |     13.000 |    106.000 |    1302.000 |     34.263 |
|    36 |   0 |  36 |   0 |   0 |   0 | GET    | /new_items/50.json                           | 0.093 | 0.834 |  11.439 | 0.318 | 0.601 | 0.635 | 0.834 |  0.157 |  23035.000 |  23647.000 |  842335.000 |  23398.194 |
|    34 |   0 |  18 |   0 |  16 |   0 | POST   | /buy                                         | 0.001 | 1.695 |  30.715 | 0.903 | 1.678 | 1.688 | 1.695 |  0.800 |      0.000 |     49.000 |    1207.000 |     35.500 |
|    23 |   0 |  14 |   0 |   9 |   0 | POST   | /ship_done                                   | 0.001 | 0.830 |  10.707 | 0.466 | 0.827 | 0.828 | 0.830 |  0.401 |     29.000 |     83.000 |     923.000 |     40.130 |
|    21 |   0 |  15 |   0 |   6 |   0 | POST   | /ship                                        | 0.002 | 0.847 |  10.022 | 0.477 | 0.838 | 0.839 | 0.847 |  0.404 |     29.000 |     61.000 |    1113.000 |     53.000 |
|    14 |   0 |  14 |   0 |   0 |   0 | POST   | /complete                                    | 0.007 | 0.834 |   9.046 | 0.646 | 0.832 | 0.834 | 0.834 |  0.326 |     34.000 |     34.000 |     476.000 |     34.000 |
|    13 |   0 |  13 |   0 |   0 |   0 | POST   | /bump                                        | 0.006 | 0.360 |   0.637 | 0.049 | 0.045 | 0.360 | 0.360 |  0.090 |     90.000 |     91.000 |    1182.000 |     90.923 |
|    11 |   0 |  11 |   0 |   0 |   0 | GET    | /items/50003.json                            | 0.002 | 0.011 |   0.050 | 0.005 | 0.008 | 0.011 | 0.011 |  0.003 |   3617.000 |   3814.000 |   41313.000 |   3755.727 |
|     9 |   0 |   9 |   0 |   0 |   0 | GET    | /items/50001.json                            | 0.006 | 0.025 |   0.133 | 0.015 | 0.025 | 0.025 | 0.025 |  0.006 |   3700.000 |   3895.000 |   34808.000 |   3867.556 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /users/3392.json                             | 0.148 | 0.424 |   2.304 | 0.288 | 0.424 | 0.424 | 0.424 |  0.103 |    620.000 |    620.000 |    4960.000 |    620.000 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /users/3886.json                             | 0.164 | 0.431 |   2.433 | 0.304 | 0.431 | 0.431 | 0.431 |  0.112 |   1067.000 |   1067.000 |    8536.000 |   1067.000 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /users/1139.json                             | 0.182 | 0.435 |   2.440 | 0.305 | 0.435 | 0.435 | 0.435 |  0.098 |    562.000 |    562.000 |    4496.000 |    562.000 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /items/50004.json                            | 0.004 | 0.044 |   0.152 | 0.019 | 0.044 | 0.044 | 0.044 |  0.011 |   3913.000 |   3928.000 |   31372.000 |   3921.500 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /items/50008.json                            | 0.004 | 0.037 |   0.132 | 0.017 | 0.037 | 0.037 | 0.037 |  0.011 |   4056.000 |   4071.000 |   32516.000 |   4064.500 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /items/50014.json                            | 0.003 | 0.106 |   0.171 | 0.021 | 0.106 | 0.106 | 0.106 |  0.033 |   3837.000 |   3852.000 |   30764.000 |   3845.500 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /items/50013.json                            | 0.008 | 0.026 |   0.122 | 0.015 | 0.026 | 0.026 | 0.026 |  0.006 |   3846.000 |   3861.000 |   30836.000 |   3854.500 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /items/50011.json                            | 0.004 | 0.028 |   0.133 | 0.017 | 0.028 | 0.028 | 0.028 |  0.008 |   3994.000 |   4009.000 |   32020.000 |   4002.500 |
$ cat /var/log/nginx/access.log | alp ltsv --sort=avg -r
+-------+-----+-----+-----+-----+-----+--------+----------------------------------------------+-------+-------+---------+-------+-------+-------+-------+--------+------------+------------+-------------+------------+
| 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   | /initialize                                  | 7.861 | 7.861 |   7.861 | 7.861 | 7.861 | 7.861 | 7.861 |  0.000 |     31.000 |     31.000 |      31.000 |     31.000 |
|   128 |   0 | 118 |   0 |  10 |   0 | GET    | /users/transactions.json                     | 0.047 | 5.892 | 354.925 | 2.773 | 5.035 | 5.222 | 5.345 |  1.713 |      0.000 |  24921.000 | 2427774.000 |  18966.984 |
|     1 |   0 |   1 |   0 |   0 |   0 | GET    | /users/3688.json                             | 2.255 | 2.255 |   2.255 | 2.255 | 2.255 | 2.255 | 2.255 |  0.000 |  23787.000 |  23787.000 |   23787.000 |  23787.000 |
|    66 |   0 |  66 |   0 |   0 |   0 | GET    | /new_items.json                              | 0.198 | 2.736 |  67.735 | 1.026 | 1.450 | 1.524 | 2.736 |  0.373 |  22997.000 |  23694.000 | 1544257.000 |  23397.833 |
|    34 |   0 |  18 |   0 |  16 |   0 | POST   | /buy                                         | 0.001 | 1.695 |  30.715 | 0.903 | 1.678 | 1.688 | 1.695 |  0.800 |      0.000 |     49.000 |    1207.000 |     35.500 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/561.json                              | 0.737 | 0.991 |   2.598 | 0.866 | 0.991 | 0.991 | 0.991 |  0.104 |   9553.000 |  23704.000 |   56456.000 |  18818.667 |
|    97 |   0 |  97 |   0 |   0 |   0 | GET    | /new_items/20.json                           | 0.207 | 2.879 |  82.743 | 0.853 | 1.350 | 1.444 | 2.879 |  0.439 |  23180.000 |  23874.000 | 2286001.000 |  23567.021 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/550.json                              | 0.762 | 0.890 |   2.457 | 0.819 | 0.890 | 0.890 | 0.890 |  0.053 |   8340.000 |  23363.000 |   55042.000 |  18347.333 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/2520.json                             | 0.785 | 0.854 |   2.457 | 0.819 | 0.854 | 0.854 | 0.854 |  0.028 |   7827.000 |  23612.000 |   54903.000 |  18301.000 |
|     1 |   0 |   1 |   0 |   0 |   0 | GET    | /users/3159.json                             | 0.813 | 0.813 |   0.813 | 0.813 | 0.813 | 0.813 | 0.813 |  0.000 |  23696.000 |  23696.000 |   23696.000 |  23696.000 |
|     1 |   0 |   1 |   0 |   0 |   0 | GET    | /users/1347.json                             | 0.809 | 0.809 |   0.809 | 0.809 | 0.809 | 0.809 | 0.809 |  0.000 |  23350.000 |  23350.000 |   23350.000 |  23350.000 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/2239.json                             | 0.624 | 0.910 |   2.415 | 0.805 | 0.910 | 0.910 | 0.910 |  0.129 |   8357.000 |  23465.000 |   55187.000 |  18395.667 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/1446.json                             | 0.622 | 0.929 |   2.390 | 0.797 | 0.929 | 0.929 | 0.929 |  0.129 |   8488.000 |  23908.000 |   55980.000 |  18660.000 |
|     1 |   0 |   1 |   0 |   0 |   0 | GET    | /users/481.json                              | 0.795 | 0.795 |   0.795 | 0.795 | 0.795 | 0.795 | 0.795 |  0.000 |  23460.000 |  23460.000 |   23460.000 |  23460.000 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/129.json                              | 0.533 | 0.984 |   2.377 | 0.792 | 0.984 | 0.984 | 0.984 |  0.190 |   8258.000 |  23394.000 |   54998.000 |  18332.667 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/1303.json                             | 0.660 | 0.904 |   2.352 | 0.784 | 0.904 | 0.904 | 0.904 |  0.100 |   9015.000 |  23849.000 |   56361.000 |  18787.000 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/818.json                              | 0.666 | 0.884 |   2.352 | 0.784 | 0.884 | 0.884 | 0.884 |  0.090 |   8549.000 |  23778.000 |   55967.000 |  18655.667 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/2084.json                             | 0.642 | 0.971 |   2.292 | 0.764 | 0.971 | 0.971 | 0.971 |  0.147 |   8521.000 |  23526.000 |   55226.000 |  18408.667 |
|    73 |   0 |  73 |   0 |   0 |   0 | GET    | /new_items/10.json                           | 0.275 | 1.449 |  51.799 | 0.710 | 0.998 | 1.077 | 1.449 |  0.217 |  23212.000 |  23993.000 | 1727864.000 |  23669.370 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/52.json                               | 0.480 | 0.899 |   2.120 | 0.707 | 0.899 | 0.899 | 0.899 |  0.173 |   7905.000 |  23385.000 |   54614.000 |  18204.667 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/62.json                               | 0.482 | 0.861 |   2.119 | 0.706 | 0.861 | 0.861 | 0.861 |  0.162 |   7816.000 |  23727.000 |   54781.000 |  18260.333 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/2533.json                             | 0.487 | 0.867 |   2.117 | 0.706 | 0.867 | 0.867 | 0.867 |  0.160 |   8778.000 |  23456.000 |   55551.000 |  18517.000 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/3138.json                             | 0.523 | 0.858 |   2.060 | 0.687 | 0.858 | 0.858 | 0.858 |  0.137 |   9524.000 |  23728.000 |   56826.000 |  18942.000 |
|    56 |   0 |  56 |   0 |   0 |   0 | GET    | /new_items/60.json                           | 0.140 | 1.796 |  37.964 | 0.678 | 1.363 | 1.426 | 1.796 |  0.445 |  22652.000 |  23311.000 | 1289123.000 |  23020.054 |
|     1 |   0 |   1 |   0 |   0 |   0 | GET    | /users/1712.json                             | 0.668 | 0.668 |   0.668 | 0.668 | 0.668 | 0.668 | 0.668 |  0.000 |   1083.000 |   1083.000 |    1083.000 |   1083.000 |
|     1 |   0 |   1 |   0 |   0 |   0 | GET    | /users/3479.json                             | 0.652 | 0.652 |   0.652 | 0.652 | 0.652 | 0.652 | 0.652 |  0.000 |  23438.000 |  23438.000 |   23438.000 |  23438.000 |
|    14 |   0 |  14 |   0 |   0 |   0 | POST   | /complete                                    | 0.007 | 0.834 |   9.046 | 0.646 | 0.832 | 0.834 | 0.834 |  0.326 |     34.000 |     34.000 |     476.000 |     34.000 |
$ cat /var/log/nginx/access.log | alp ltsv --sort=sum -r
+-------+-----+-----+-----+-----+-----+--------+----------------------------------------------+-------+-------+---------+-------+-------+-------+-------+--------+------------+------------+-------------+------------+
| COUNT | 1XX | 2XX | 3XX | 4XX | 5XX | METHOD |                     URI                      |  MIN  |  MAX  |   SUM   |  AVG  |  P90  |  P95  |  P99  | STDDEV | MIN(BODY)  | MAX(BODY)  |  SUM(BODY)  | AVG(BODY)  |
+-------+-----+-----+-----+-----+-----+--------+----------------------------------------------+-------+-------+---------+-------+-------+-------+-------+--------+------------+------------+-------------+------------+
|   128 |   0 | 118 |   0 |  10 |   0 | GET    | /users/transactions.json                     | 0.047 | 5.892 | 354.925 | 2.773 | 5.035 | 5.222 | 5.345 |  1.713 |      0.000 |  24921.000 | 2427774.000 |  18966.984 |
|    97 |   0 |  97 |   0 |   0 |   0 | GET    | /new_items/20.json                           | 0.207 | 2.879 |  82.743 | 0.853 | 1.350 | 1.444 | 2.879 |  0.439 |  23180.000 |  23874.000 | 2286001.000 |  23567.021 |
|    66 |   0 |  66 |   0 |   0 |   0 | GET    | /new_items.json                              | 0.198 | 2.736 |  67.735 | 1.026 | 1.450 | 1.524 | 2.736 |  0.373 |  22997.000 |  23694.000 | 1544257.000 |  23397.833 |
|    73 |   0 |  73 |   0 |   0 |   0 | GET    | /new_items/10.json                           | 0.275 | 1.449 |  51.799 | 0.710 | 0.998 | 1.077 | 1.449 |  0.217 |  23212.000 |  23993.000 | 1727864.000 |  23669.370 |
|    56 |   0 |  56 |   0 |   0 |   0 | GET    | /new_items/60.json                           | 0.140 | 1.796 |  37.964 | 0.678 | 1.363 | 1.426 | 1.796 |  0.445 |  22652.000 |  23311.000 | 1289123.000 |  23020.054 |
|    64 |   0 |  64 |   0 |   0 |   0 | GET    | /new_items/40.json                           | 0.205 | 1.473 |  37.137 | 0.580 | 0.985 | 1.091 | 1.473 |  0.299 |  23422.000 |  24004.000 | 1522235.000 |  23784.922 |
|    34 |   0 |  18 |   0 |  16 |   0 | POST   | /buy                                         | 0.001 | 1.695 |  30.715 | 0.903 | 1.678 | 1.688 | 1.695 |  0.800 |      0.000 |     49.000 |    1207.000 |     35.500 |
|    59 |   0 |  51 |   0 |   8 |   0 | POST   | /login                                       | 0.087 | 1.072 |  29.801 | 0.505 | 1.007 | 1.021 | 1.072 |  0.312 |     73.000 |    107.000 |    5599.000 |     94.898 |
|    43 |   0 |  43 |   0 |   0 |   0 | GET    | /new_items/1.json                            | 0.111 | 1.118 |  23.571 | 0.548 | 0.902 | 0.930 | 1.118 |  0.301 |  22971.000 |  23581.000 |  999635.000 |  23247.326 |
|    40 |   0 |  38 |   0 |   2 |   0 | GET    | /new_items/30.json                           | 0.146 | 1.015 |  17.187 | 0.430 | 0.556 | 0.637 | 1.015 |  0.149 |      0.000 |  23981.000 |  897088.000 |  22427.200 |
|    36 |   0 |  36 |   0 |   0 |   0 | GET    | /new_items/50.json                           | 0.093 | 0.834 |  11.439 | 0.318 | 0.601 | 0.635 | 0.834 |  0.157 |  23035.000 |  23647.000 |  842335.000 |  23398.194 |
|    23 |   0 |  14 |   0 |   9 |   0 | POST   | /ship_done                                   | 0.001 | 0.830 |  10.707 | 0.466 | 0.827 | 0.828 | 0.830 |  0.401 |     29.000 |     83.000 |     923.000 |     40.130 |
|    21 |   0 |  15 |   0 |   6 |   0 | POST   | /ship                                        | 0.002 | 0.847 |  10.022 | 0.477 | 0.838 | 0.839 | 0.847 |  0.404 |     29.000 |     61.000 |    1113.000 |     53.000 |
|    14 |   0 |  14 |   0 |   0 |   0 | POST   | /complete                                    | 0.007 | 0.834 |   9.046 | 0.646 | 0.832 | 0.834 | 0.834 |  0.326 |     34.000 |     34.000 |     476.000 |     34.000 |
|     1 |   0 |   1 |   0 |   0 |   0 | POST   | /initialize                                  | 7.861 | 7.861 |   7.861 | 7.861 | 7.861 | 7.861 | 7.861 |  0.000 |     31.000 |     31.000 |      31.000 |     31.000 |
|    51 |   0 |  51 |   0 |   0 |   0 | GET    | /settings                                    | 0.001 | 0.683 |   5.451 | 0.107 | 0.318 | 0.495 | 0.683 |  0.159 |   2939.000 |   2953.000 |  150161.000 |   2944.333 |
|    38 |   0 |  26 |   0 |  12 |   0 | POST   | /sell                                        | 0.001 | 1.067 |   4.805 | 0.126 | 0.496 | 0.619 | 1.067 |  0.221 |     13.000 |    106.000 |    1302.000 |     34.263 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /users/2224.json                             | 0.243 | 0.449 |   2.788 | 0.348 | 0.449 | 0.449 | 0.449 |  0.075 |   1069.000 |   1069.000 |    8552.000 |   1069.000 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/561.json                              | 0.737 | 0.991 |   2.598 | 0.866 | 0.991 | 0.991 | 0.991 |  0.104 |   9553.000 |  23704.000 |   56456.000 |  18818.667 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /users/1492.json                             | 0.157 | 0.504 |   2.565 | 0.321 | 0.504 | 0.504 | 0.504 |  0.124 |   1503.000 |   1503.000 |   12024.000 |   1503.000 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/2520.json                             | 0.785 | 0.854 |   2.457 | 0.819 | 0.854 | 0.854 | 0.854 |  0.028 |   7827.000 |  23612.000 |   54903.000 |  18301.000 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/550.json                              | 0.762 | 0.890 |   2.457 | 0.819 | 0.890 | 0.890 | 0.890 |  0.053 |   8340.000 |  23363.000 |   55042.000 |  18347.333 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /users/1139.json                             | 0.182 | 0.435 |   2.440 | 0.305 | 0.435 | 0.435 | 0.435 |  0.098 |    562.000 |    562.000 |    4496.000 |    562.000 |
|     8 |   0 |   8 |   0 |   0 |   0 | GET    | /users/3886.json                             | 0.164 | 0.431 |   2.433 | 0.304 | 0.431 | 0.431 | 0.431 |  0.112 |   1067.000 |   1067.000 |    8536.000 |   1067.000 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/2239.json                             | 0.624 | 0.910 |   2.415 | 0.805 | 0.910 | 0.910 | 0.910 |  0.129 |   8357.000 |  23465.000 |   55187.000 |  18395.667 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/1446.json                             | 0.622 | 0.929 |   2.390 | 0.797 | 0.929 | 0.929 | 0.929 |  0.129 |   8488.000 |  23908.000 |   55980.000 |  18660.000 |
|     3 |   0 |   3 |   0 |   0 |   0 | GET    | /users/129.json                              | 0.533 | 0.984 |   2.377 | 0.792 | 0.984 | 0.984 | 0.984 |  0.190 |   8258.000 |  23394.000 |   54998.000 |  18332.667 |

/items/50003.jsonとか/users/2224.jsonとか/new_items/1.jsonみたいにIDが違うだけで同じハンドラーで処理されるURIをまとめたい時は-mを使えばまとめられる。

$ cat /var/log/nginx/access.log | alp ltsv -m '/items/[0-9]+,/users/[0-9]+,/new_items/[0-9]+' --sort=sum -r
+-------+-----+------+-----+-----+-----+--------+----------------------------------------------+-------+-------+---------+-------+-------+-------+-------+--------+------------+------------+--------------+------------+
| COUNT | 1XX | 2XX  | 3XX | 4XX | 5XX | METHOD |                     URI                      |  MIN  |  MAX  |   SUM   |  AVG  |  P90  |  P95  |  P99  | STDDEV | MIN(BODY)  | MAX(BODY)  |  SUM(BODY)   | AVG(BODY)  |
+-------+-----+------+-----+-----+-----+--------+----------------------------------------------+-------+-------+---------+-------+-------+-------+-------+--------+------------+------------+--------------+------------+
|   195 |   0 |  185 |   0 |  10 |   0 | GET    | /users/transactions.json                     | 0.012 | 8.092 | 560.641 | 2.875 | 4.882 | 5.686 | 6.528 |  1.703 |      0.000 |  30965.000 |  3929865.000 |  20153.154 |
|    72 |   0 |   41 |   0 |  31 |   0 | POST   | /buy                                         | 0.001 | 1.758 |  74.886 | 1.040 | 1.657 | 1.670 | 1.758 |  0.779 |      0.000 |     49.000 |     2493.000 |     34.625 |
|  4157 |   0 | 4157 |   0 |   0 |   0 | GET    | /items/[0-9]+                                | 0.005 | 0.274 |  40.873 | 0.010 | 0.017 | 0.026 | 0.041 |  0.010 |   1843.000 |   4128.000 |  9051852.000 |   2177.496 |
|    60 |   0 |   39 |   0 |  21 |   0 | POST   | /ship_done                                   | 0.829 | 0.858 |  35.244 | 0.587 | 0.843 | 0.845 | 0.858 |  0.378 |     29.000 |     83.000 |     2369.000 |     39.483 |
|    55 |   0 |   41 |   0 |  14 |   0 | POST   | /ship                                        | 0.001 | 0.901 |  32.200 | 0.585 | 0.853 | 0.880 | 0.901 |  0.385 |     29.000 |     61.000 |     2963.000 |     53.873 |
|    35 |   0 |   35 |   0 |   0 |   0 | POST   | /complete                                    | 0.031 | 0.863 |  26.966 | 0.770 | 0.853 | 0.858 | 0.863 |  0.225 |     34.000 |     34.000 |     1190.000 |     34.000 |
|  1625 |   0 | 1625 |   0 |   0 |   0 | GET    | /new_items/[0-9]+                            | 0.005 | 0.415 |  25.132 | 0.015 | 0.021 | 0.034 | 0.197 |  0.031 |  22722.000 |  24080.000 | 38211843.000 |  23514.980 |
|    62 |   0 |   54 |   0 |   8 |   0 | POST   | /login                                       | 0.088 | 0.875 |  21.273 | 0.343 | 0.696 | 0.863 | 0.875 |  0.261 |     73.000 |    104.000 |     5862.000 |     94.548 |
|    54 |   0 |   54 |   0 |   0 |   0 | GET    | /settings                                    | 0.008 | 0.599 |   9.324 | 0.173 | 0.523 | 0.563 | 0.599 |  0.181 |   2936.000 |   2950.000 |   158962.000 |   2943.741 |
|     1 |   0 |    1 |   0 |   0 |   0 | POST   | /initialize                                  | 9.251 | 9.251 |   9.251 | 9.251 | 9.251 | 9.251 | 9.251 |  0.000 |     31.000 |     31.000 |       31.000 |     31.000 |
|    68 |   0 |   47 |   0 |  21 |   0 | POST   | /sell                                        | 0.001 | 0.973 |   6.771 | 0.100 | 0.309 | 0.837 | 0.973 |  0.222 |     13.000 |    106.000 |     2298.000 |     33.794 |
|   308 |   0 |  308 |   0 |   0 |   0 | GET    | /users/[0-9]+                                | 0.003 | 0.335 |   4.245 | 0.014 | 0.023 | 0.030 | 0.182 |  0.030 |     96.000 |  24060.000 |  4560759.000 |  14807.659 |
|   142 |   0 |  142 |   0 |   0 |   0 | GET    | /new_items.json                              | 0.005 | 0.193 |   2.520 | 0.018 | 0.034 | 0.040 | 0.070 |  0.019 |  23038.000 |  23921.000 |  3331844.000 |  23463.690 |
|    13 |   0 |   13 |   0 |   0 |   0 | POST   | /bump                                        | 0.023 | 0.424 |   0.750 | 0.058 | 0.041 | 0.424 | 0.424 |  0.106 |     90.000 |     92.000 |     1184.000 |     91.077 |
|    10 |   0 |    3 |   0 |   7 |   0 | POST   | /items/edit                                  | 0.012 | 0.044 |   0.194 | 0.019 | 0.030 | 0.044 | 0.044 |  0.010 |     58.000 |     93.000 |      682.000 |     68.200 |
|     1 |   0 |    1 |   0 |   0 |   0 | GET    | /transactions/15028.png                      | 0.082 | 0.082 |   0.082 | 0.082 | 0.082 | 0.082 | 0.082 |  0.000 |    603.000 |    603.000 |      603.000 |    603.000 |
|     1 |   0 |    1 |   0 |   0 |   0 | GET    | /transactions/15027.png                      | 0.063 | 0.063 |   0.063 | 0.063 | 0.063 | 0.063 | 0.063 |  0.000 |    606.000 |    606.000 |      606.000 |    606.000 |
|     3 |   0 |    1 |   0 |   2 |   0 | GET    | /transactions/15026.png                      | 0.009 | 0.015 |   0.037 | 0.012 | 0.015 | 0.015 | 0.015 |  0.002 |     33.000 |    606.000 |      676.000 |    225.333 |
|     1 |   0 |    1 |   0 |   0 |   0 | GET    | /upload/3061fdfaf0cd5aaaaf21c45f76ffc8e4.jpg | 0.036 | 0.036 |   0.036 | 0.036 | 0.036 | 0.036 | 0.036 |  0.000 |  55616.000 |  55616.000 |    55616.000 |  55616.000 |
|     3 |   0 |    1 |   0 |   2 |   0 | GET    | /transactions/15010.png                      | 0.007 | 0.015 |   0.032 | 0.011 | 0.015 | 0.015 | 0.015 |  0.003 |     33.000 |    610.000 |      680.000 |    226.667 |
|     3 |   0 |    1 |   0 |   2 |   0 | GET    | /transactions/15036.png                      | 0.007 | 0.012 |   0.029 | 0.010 | 0.012 | 0.012 | 0.012 |  0.002 |     33.000 |    612.000 |      682.000 |    227.333 |
|     3 |   0 |    1 |   0 |   2 |   0 | GET    | /transactions/15030.png                      | 0.007 | 0.010 |   0.027 | 0.009 | 0.010 | 0.010 | 0.010 |  0.001 |     33.000 |    620.000 |      690.000 |    230.000 |
|     3 |   0 |    1 |   0 |   2 |   0 | GET    | /transactions/15053.png                      | 0.007 | 0.009 |   0.025 | 0.008 | 0.009 | 0.009 | 0.009 |  0.001 |     33.000 |    617.000 |      687.000 |    229.000 |
|     3 |   0 |    1 |   0 |   2 |   0 | GET    | /transactions/15022.png                      | 0.006 | 0.010 |   0.025 | 0.008 | 0.010 | 0.010 | 0.010 |  0.002 |     33.000 |    622.000 |      692.000 |    230.667 |
|     3 |   0 |    1 |   0 |   2 |   0 | GET    | /transactions/15049.png                      | 0.006 | 0.009 |   0.023 | 0.008 | 0.009 | 0.009 | 0.009 |  0.001 |     33.000 |    608.000 |      678.000 |    226.000 |
|     1 |   0 |    1 |   0 |   0 |   0 | GET    | /static/js/main.babc3d4d.chunk.js            | 0.019 | 0.019 |   0.019 | 0.019 | 0.019 | 0.019 | 0.019 |  0.000 |  90365.000 |  90365.000 |    90365.000 |  90365.000 |
|     1 |   0 |    1 |   0 |   0 |   0 | GET    | /static/css/main.19393e92.chunk.css          | 0.019 | 0.019 |   0.019 | 0.019 | 0.019 | 0.019 | 0.019 |  0.000 |    994.000 |    994.000 |      994.000 |    994.000 |

便利で使いやすくてとてもすごい。

© Akihito Ikeda - Last update 22.08.2021 19:15.