Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculated bandwidth doubles #219

Open
JamesColeman-LW opened this issue Mar 24, 2022 · 0 comments
Open

calculated bandwidth doubles #219

JamesColeman-LW opened this issue Mar 24, 2022 · 0 comments

Comments

@JamesColeman-LW
Copy link

JamesColeman-LW commented Mar 24, 2022

Describe the bug
In reviewing some awstats reports, I noted that the bandwidth calculation was way off. After reviewing why, I isolated it to a single line with bandwidth of 359489526 bytes. I have attached an example anonymized log file which is able to reproduce this output.

To Reproduce
Steps to reproduce the behavior:

  1. Put awstats.test.conf in /etc/awstats/
  2. Download the awstats-7.8 and place its extracted directory in the home directory.
  3. Make a folder in root, or modify the awstats.test.conf file to replace /awstats-test with your testing location.
  4. Place the www.log file in the awstats-test directory.
  5. Change directory into the awstats-test directory.
  6. Run the following commands:
perl ~/awstats-7.8/wwwroot/cgi-bin/awstats.pl -config=test -year=2022  -month=02 --update
echo -n "perl calc: "
cat www.log | perl -e 'my $sum=0; while(<>) { my ($traffic) = m/\[.+\] ".+" \d+ (\d+)/; $sum += $traffic}; print "$sum\n"'
echo -n "awstats calc: "
grep -E "^# Date" -A2 awstats022022.test.txt | tail -n 1 | awk '{print $4}'

Expected behavior
Calculated bandwidth to equal 359489573 which is the sum of the log lines.

Desktop (please complete the following information):

  • OS: centos 7
  • Browser N/A
  • Version 7.8

Additional context
Tested on perl v5.16.3 and v5.34.0

Attachments
www.log
awstats.test.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant