0
我正在使用ngxtop進行nginx日誌監視。使用ngxtop按特定日期進行過濾
ngxtop --no-follow
這將輸出訪問日誌中所有數據的請求計數。 我只對當前日期前一天的請求數感興趣。
有沒有一種方法可以輸出特定日期的請求計數?
我正在使用ngxtop進行nginx日誌監視。使用ngxtop按特定日期進行過濾
ngxtop --no-follow
這將輸出訪問日誌中所有數據的請求計數。 我只對當前日期前一天的請求數感興趣。
有沒有一種方法可以輸出特定日期的請求計數?
nxtop使用Python作爲其篩選標誌(-i
)。
使用的變量名是那些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"
。