Commit Graph

64 Commits

Author SHA1 Message Date
Thor77 4c872930db
Update pendulum to 2.1.2 2023-01-14 19:02:53 +01:00
Thor77 f878fefeaa Use raw strings for RegEx's 2018-05-19 18:06:59 +02:00
Thor77 1ef4a3bc15 Handle connected clients on unexpected shutdown
caused, for example, by a server crash.
Could be triggered by an incorrectly named logfile as well because it is
assumed once there are connected clients in a logfile which isn't the
last one to be parsed.

The fix is realized by taking the timestamp of the last event from the
currently parsed logfile and disconnecting all still connected clients
on that timestamp.
2018-05-19 17:28:03 +02:00
Thor77 6e40555612 Only log online_clients if there are any
at the end of a logfile.
2018-05-02 20:59:23 +02:00
Thor77 8d1c19a734 Adapt log.parse_logs and utils.sort_clients
to Clients.__iter__ return keys instead of values
2017-09-25 23:21:06 +02:00
Thor77 1e1f112867 Add funcdoc to tsstats.log._parse_line 2017-09-15 10:51:29 +02:00
Thor77 c79dd08bc0 Don't accept infinite arguments
leftover from old parse_logs-func
2017-09-09 18:04:56 +02:00
Thor77 df268f1c2a Add return and rtype to parse_logs-funcdoc 2017-09-08 15:39:39 +02:00
Thor77 602e6c4d51 Log start/end of parsing logfile 2017-09-08 15:39:39 +02:00
Thor77 91a9b8e4c7 Implement online_dc again 2017-09-08 15:39:39 +02:00
Thor77 90a367da27 Warn about online clients on logfile end 2017-09-08 15:39:39 +02:00
Thor77 3d6c41538b Indent return of parsed_events correctly 2017-09-08 15:39:39 +02:00
Thor77 96d6e9f050 Only yield Server if there are clients for it 2017-09-08 15:39:39 +02:00
Thor77 08b4e06f10 Refactor and simplify log-parsing
* _parse_line parses one line at a time for simplified testing
and return a list of event.Event's instead of applying changes directly
to a Clients-obj
* parse_log just bundles the logs (using _bundle_logs), opens them,
parses them (using _parse_line) and applies returned events to a
Clients-obj in the correct order

With these changes some sort of caching is possible because events are
not bound to a specific client-object and are easily sortable due to
their attached timestamp.
2017-09-08 15:39:39 +02:00
Thor77 65a8379261 Use pendulum instead of plain datetime
because it is more intuitive to use and doesn't require the
tz_aware_datetime-workaround.
2017-07-07 14:22:24 +02:00
Thor77 a4c04e34c8 Close log files after parsing 2017-05-11 11:32:11 +02:00
Thor77 8d18b9c4ae Fix not using defined variable for match-access
possibly leading to slower access-times
2017-03-31 22:21:54 +02:00
Thor77 1bc555d66c Add IdentMap-lookup for new clients
added to clients-collection during log-parsing

Fix #18
2017-03-30 20:10:08 +02:00
Thor77 0081ac9939 Log parse time of individual logs 2017-03-24 23:18:26 +01:00
Thor77 4adfb9cfc1 Make all datetime-objects timezone-aware
Because the tool is using utc-timestamps everywhere, this emphasizes
this fact (by default) in the output.
If you don't want timezones behind each datetime in your output, just
remove the "%Z" from the `datetimeformat`.

Fix #9
2017-02-16 22:44:51 +01:00
Thor77 22f6402bce Add nick-history functionality
hover a nickname to show previous nicks
2017-02-11 22:14:34 +01:00
Thor77 fdbde18856 parse_logs: Return Server instead of dict
because it's easier to iterate and access contained information
2016-11-19 22:25:57 +01:00
Thor77 03c0941962 Add safety-measure to ensure clients disconnect at server stop 2016-11-06 19:23:00 +01:00
Thor77 c8955bee5e Remove double-iteratation over logfiles
by passing the iterator returned by glob.glob direclty to _bundle_logs
2016-11-06 19:18:21 +01:00
Thor77 812916f179 Use list-comprehension for reconnect
to make this action more obvious and understandable
2016-11-04 20:03:46 +01:00
Thor77 ba8e082e64 Reconnect clients only for last log (online_dc)
because doing it after every log would lead to insane onlinetimes
and only the last log should have online clients, anyways.

Fix #4
2016-11-03 22:52:05 +01:00
Thor77 c0096a7c52 Read logs as utf-8 2016-11-02 21:24:07 +01:00
Thor77 2d80ba6804 Add action-group to re_dis_connect.
Used to not rely on position in message
for correct action-parsing.
2016-10-27 00:08:28 +02:00
Thor77 b6e73e733d Fix adding server/clientgroup-actions to clients.
This was caused, because the used regex was very generic.
Therefore it parsed these lines without any problems,
a timestamp wasn't added but it was already in the clients-dict,
when these checks (conn or disconnect) were performed.
2016-10-27 00:02:56 +02:00
Thor77 0b667f55b7 check for None instead of False to allow empty clients as arg to tsstats.log._parse_details 2016-06-22 20:40:30 +02:00
Thor77 def9f2e1e2 fix logpath not given to _bundle_logs in tsstats.log.parse_logs 2016-06-21 22:16:39 +02:00
Thor77 21be54675f add proper func-doc to tsstats.log.parse_logs 2016-06-21 18:29:59 +02:00
Thor77 c132c17661 add ident_map-arg to tsstats.log.parse_logs
* give all given arguments to tsstats.log._bundle_logs while parsing (*args,
**kwargs)
2016-06-21 18:20:57 +02:00
Thor77 c0f1a6c649 add glob-resolution to tsstats.log.parse_logs
* correct name of bundle-function (to tsstats.log._bundle_logs)
* add .items() to correct for-loop
2016-06-20 22:02:55 +02:00
Thor77 9a6bbe4f3e fix 2 typos in tsstats.log._bundle_logs 2016-06-20 21:59:46 +02:00
Thor77 105f464b9a sort logs by path, if timestamp not available, though 2016-06-20 21:38:57 +02:00
Thor77 e92ad9e6fe update scope of tsstats.log._sort_logs (rename to tsstats.log._bundle_logs)
* rename to tsstats.log._bundle_logs
* expect list of logpaths as argument and return them sorted
* move globbing-stuff to parse_logs in an upcoming commit
2016-06-20 21:31:59 +02:00
Thor77 612055a088 add wip tsstats.log.parse_logs 2016-06-19 22:26:19 +02:00
Thor77 0c57b27abc update documentation of tsstats.log._sort_logfiles to fit updated scope 2016-06-19 22:21:02 +02:00
Thor77 37a9841900 rename tsstats.log.parse_logs to tsstats.log._sort_logfiles to fit updated scope 2016-06-19 22:13:05 +02:00
Thor77 ad7ff96b1b add filename-checking to split logs by sid
* if filename doesn't match, fallback to plain sorting
* using re_log_filename to match
2016-06-19 22:10:35 +02:00
Thor77 bec0279871 rename tsstats.log.parse_log to tsstats.log._parse_details 2016-06-19 21:44:23 +02:00
Thor77 2821713150 redefine scope of tsstats.log.* in func-docs 2016-06-19 21:37:00 +02:00
Thor77 28855e9a81 use datetime.timedelta for Client.onlinetime instead of int
* get rid of all the converting-stuff
2016-06-12 17:52:44 +02:00
Thor77 9d5197d813 use py2-compatible way to convert datetime.datetime to timestamp
* bump version to 0.6.8
2016-06-12 17:20:32 +02:00
Thor77 276dce0074 give all *args and **kwargs given to tsstats.log.parse_logs directly to parse_log 2016-06-12 17:01:35 +02:00
Thor77 4e4eacd3af disconnect online clients after parsing to display correct onlinetime
* toggle by setting tsstats.log(online_dc=)
* fix #1
2016-06-12 16:54:49 +02:00
Thor77 4acfe5bd0b fix references to identmap-doc from tsstats.client and tsstats.log
* use :doc: instead of :ref:
* bump version to 0.6.5
2016-06-08 22:36:26 +02:00
Thor77 52a05acdab add source-encoding (utf-8) to all files 2016-06-07 17:42:53 +02:00
Thor77 c3cfad0a88 fix wrong regex for logs with unexpected spacing
* add "\ *" arround level, component, sid and message
2016-06-07 16:51:55 +02:00