2017-03-08 9 views
0

nginxログの監視にngxtopを使用しています。ngxtopを使用して特定の日付でフィルタリングする

ngxtop --no-follow 

これは、アクセスログ内のすべてのデータの要求数を出力します。 私はちょうど現在の日付より1日前のリクエスト数に興味があります。

特定の日付のリクエスト数を出力する方法はありますか?

答えて

0

nxtopは、フィルタフラグ(-i)としてPythonを使用します。使用

変数名はhttp://nginx.org/en/docs/http/ngx_http_log_module.html

のものであり、だから、このように日付でフィルタリングすることができます:

ngxtop --no-follow -i 'time_local > "12/Jan/2018:20:00:00"' print remote_addr time_local request

注、複数のフィルタは、Pythonの式ではなく、複数で指定する必要があります-iフラグ、例えば -i 'time_local > "12/Jan/2018:00:00:00"' and time_local < "20/Jan/2018:00:00:00"

関連する問題