Hello!
In some reports I need to take time into account. So when I run
sarg ... -t 09:00-18:00
there is a total traffic for the period displayed in the bottom of the table.
It is also possible to use hours parameter in sarg.conf instead of (-t) CLI parameter. In this way total traffic equals to 0.
So they work not really the same way.
I think this problem is now solved with commit [371bd6].
You are right. Command line option "-t" is very different from the "hours" configuration option.
"-t" limits the reports to one hour (-t 10 for instance) or one range (-t 8-16 for instance). Any entry outside of the selected hours is ignored. It affects every report including --split and --convert.
"hours" accepts a complex set of hours and ignores entries not in one of the listed hour. It doesn't change --split nor --convert. It affects the hourly report in a more direct manner (it actually hides the excluded hourly columns).
"hours" had some bugs. The hourly report was wrong due to those bugs. All should be working well now.
I'm reluctant to make the two options identical due to all the differences that currently exist. It makes sense that "-t" should behave like "hours" and accept the same complex set of hours but it is a major change in how "-t" currently works. I'll think about it before doing anything. Comments are welcome.
Related
Commit: [371bd6]
Yes, now it's okay!
But I'd like to add something.
1) I've attached two screenshots.
sarg-hour.png - how it was before and after the last commit. We see here only amount of traffic according to requested hours.
sarg-t.png - basically the same report but the time range is requested in CLI by -t parameter. Here we see all hours.
Maybe it would be right to represent both reports in the same way: either including every hour even though they are not requested, or only hours in a requested range?
2) As I noticed, -t 9:00-17:59 equals to hours 9-17 and it means "from 9 till 17:59 and every secon of last minute, up to 17:59:59.999". I think it is more obvious if you type -t 9:00-18:00 and SARG rejecting the log records written in a log file after 18:00:00.
"hours" and "-t" are, internally, very different things. The hourly report hiding excluded columns in one case and not in the other is the most prominent difference. That's what your screen captures show.
The second difference is in the accepted arguments. "hours" accepts a list such as
8-12,13-17. Only hours, no minutes. "-t" takes only one time or a range. Minutes are mandatory here but lists are not allowed.I haven't figured out how to merge "hours" and "-t" without breaking compatibility.
I agree that
-t 9:00-18:00makes more sense.So it is not as simple as changing '<=' to '<'? :)
Changing "-t 09:00-18:00" is very easy. It is available in commit [371bd6]. I just pushed it to git :-) I'll update the wiki page too.
Merging "hours" and "-t" is much more tricky though.
Related
Commit: [371bd6]
Thank you!