Closed UnR34L closed 7 years ago
That doesn't look like an error from tsstats. Or was there more output than that (if so, please post the complete traceback)?
Try quoting the globbing path (tsstats -l "/var/log/teamspeak/ts3server*.log" [...]
), maybe your shell tries to expand it itself.
root@teamspeak_10:/ # tsstats -l "/var/log/teamspeak/ts3server*.log" -o /root/stats.html
Traceback (most recent call last):
File "/usr/local/bin/tsstats", line 9, in <module>
load_entry_point('tsstats==0.12.0', 'console_scripts', 'tsstats')()
File "/usr/local/lib/python2.7/site-packages/tsstats/__main__.py", line 60, in cli
main(configuration)
File "/usr/local/lib/python2.7/site-packages/tsstats/__main__.py", line 94, in main
datetime_fmt=configuration.get('General', 'datetimeformat')
File "/usr/local/lib/python2.7/site-packages/tsstats/template.py", line 69, in render_template
creation_time=datetime.now()))
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/site-packages/tsstats/template.html", line 27, in top-level template code
{% set id = headline_id + "." + client.nick %}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 8: ordinal not in range(128)
Right so, adding the quotes gave a different output ^
Which python-version are you running?
Please try running python -c "import sys;print(sys.getdefaultencoding())
to see your encoding. It seems like your current encoding can't decode a byte in a clients nickname. Setting a locale with UTF-8 support should fix that (not sure how to do that on FreeBSD, though).
My locale appears to be setup correctly now (it wasn't before):
root@teamspeak_10:/ # locale
LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_ALL=
This is the output from python.
root@teamspeak_10:/ # python2.7 -c 'import sys; print(sys.getdefaultencoding())'
ascii
Did you try to run tsstats
after your locale-change? It should work fine with these.
Yes, I ran it after every change I made, logged out a few times and even restarted the jail.
your current encoding can't decode a byte in a Clients nickname
This feels like the problem, I randomly selected a few log files, one of them worked, it had four clients.
http://image.prntscr.com/image/bdceb3f3dd0d494bbe1239b16f92dd06.png
Having no locale set may have borked the ts3 logs.
Thanks for your time, cool project.
Hm, I don't really think that's the (only) problem.
This feels like the problem, I randomly selected a few log files, one of them worked, it had four clients.
These numbers don't look correct oO This issue could be debugged by using the debug-mode (passing -d
), though.
Can you post the affected nicks (from the log-files that didn't parse correctly) for further debugging? To make sure the problem is really with your old locale, you could restart your teamspeak3-server, join with a nick with chars not supported by ansii in it and try to parse the new-logfile with tsstats.
Thanks for your help :)
Unrelated but interesting, I used three months of logs, I had a connection time of over 1000 days.. in three months.
It's working with one months worth of logs, but to be safe I've used todays logs and it's looking accurate.
Redacted
Would it be helpful to give you a log I know is not working ?
Redacted
Yeah, that's very helpful, thanks 👍 Hm, these numbers don't look too wrong to me (not >1000d of onlinetime at least). Can't really reproduce your issue. It's working fine on my machine. Are you still referring to your encoding-issue or to insane onlinetimes?
Encoding issues, since using that log file gives errors.
As for the >1000 days, finding that file would take some effort (137 log files in total)
Using that same log file I showed you, this is the output with '-d' but seems to be the same output as before.
root@teamspeak_10:/ # /usr/local/bin/tsstats -d -l "/var/log/teamspeak/ts3server_2016-07-08__08_30_40.259891_1.log" -o /media/index.html
Traceback (most recent call last):
File "/usr/local/bin/tsstats", line 9, in <module>
load_entry_point('tsstats==0.12.0', 'console_scripts', 'tsstats')()
File "/usr/local/lib/python2.7/site-packages/tsstats/__main__.py", line 60, in cli
main(configuration)
File "/usr/local/lib/python2.7/site-packages/tsstats/__main__.py", line 94, in main
datetime_fmt=configuration.get('General', 'datetimeformat')
File "/usr/local/lib/python2.7/site-packages/tsstats/template.py", line 69, in render_template
creation_time=datetime.now()))
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/site-packages/tsstats/template.html", line 27, in top-level template code
{% set id = headline_id + "." + client.nick %}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 8: ordinal not in range(128)
Right now, I just started fresh only using recent log files and there's no issues with weird online times or errors.
Ah, I can reproduce your error in Python 2.7 (couldn't in Python 3.5), will hunt that down and comment here as soon as I find a solution. Thanks again for providing the logfile.
Fixed in 0.12.5, you can upgrade with pip install --upgrade tsstats
.
Please close this issue, if you can confirm the fix.
Fixed =)
tsstats -l /var/log/teamspeak/ts3server*.log -o /root/stats.html
Getting this error: "tsstats: error: unrecognized arguments:"
FreeBSD Server.