0

I'm trying to count the number of requests my nginx reverse proxies served in the last 30 days. I'm doing this by counting all the lines in access logs plus the rotated access logs. I have logs for 30 days.

cd /var/log/nginx
for file in access.log*.gz; do zcat $file | wc -l; done
wc -l access.log

Then I sum all the resultant numbers. Should I also add the lines in error log to this? Are there any better ways to calculate the total number of requests? Are there any pitfalls I should know about?

0

1 Answer 1

4

No... errors are simple that ... errors. There will also be a matching request (with a status code) in your access log. There may be one-or-more errors with any 4xx or 5xx status returns (which, again, should be reflected in your access log).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.