2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-17 05:10:52 +00:00

30 Commits

Author SHA1 Message Date
Jarrod Johnson
4bbc05699e Fixed log age out with size and time rolling
There was a problem if both size and time based age out were triggering
and failing to honor backupCount.
2017-11-10 08:48:36 -05:00
Jarrod Johnson
1dd40d36a1 Breakup logentries exceeding 65k
The data length of a log entry must not exceed 65k.  If an attempt is
made to log that much, break it up and duplicate the records.  It may make
sense to indicate a continuation explicitly, but for now just extend.
2017-07-20 11:05:06 -04:00
Jarrod Johnson
a894624403 Fix python 2.6 compatibility in log
python 2.6 requires a numeric argument to {}
2017-06-27 14:48:33 -04:00
Jarrod Johnson
e0cc67f57a Implement Lenovo Thinksystem and discovery support 2017-06-20 14:56:24 -04:00
Jarrod Johnson
e230f803ce Correct missing argument
__new__ was missed in the last commit.
2017-04-11 15:42:16 -04:00
Jarrod Johnson
563a2b11c3 Change the stdout/stderr/trace logs to not buffer things over time
If something went completely off the rails, it could easily fill up lots of memory with log entries in the 2 seconds it
would buffer.  For now disable the buffering on key debug logs, as the main purpose was reducing IOPs in the per-node
console logs anyway.  A future behavior may be to also limit the size and/or number of outstanding log entries before
committing to disk.
2017-04-11 14:40:05 -04:00
Jarrod Johnson
6f9bdf4a7c Create multiple files on roll conflict
Rather than removing the previous file, append a digit
to denote extra log files sharing the same roll date.
2016-10-18 11:28:47 -04:00
Jarrod Johnson
4eaab9db37 Avoid inifinite replay loop on bad previouslogfile
If circumstances result in a log file after rollover
pointing at itself, break out rather than looping trying
to get the same data from itself.
2016-10-18 11:18:57 -04:00
Jarrod Johnson
29da853bcf Add mac map lookup against config to get node
This brings things right to the level of xCAT in
terms of underlying capability.  mac addresses have both
an all inclusive list of ports it is found on, and any nodes
that it matches.  It goes another step further by logging errors
when ambiguity is detected (either verbatim config conflict or
ambiguous result based on 'namesmatch' and the switch config).
2016-07-14 09:27:15 -04:00
Jarrod Johnson
7a72de6033 Improve behavior of mac map
One, include a number of 'fellow' mac addresses on the same port.
Another, allow a mac to appear on multiple ports and have that
reflected in the data structure.  Also capture errors to trace
log rather than hanging up on unexpected cases.
2016-07-14 09:27:15 -04:00
Jarrod Johnson
4aeb7e1df5 Provide a simple global 'log' function
As we implement internal processes with automation,
provide a hook for code to convey information about
situations encountered during background activity.
Ultimately, it is intended to hook event forwarders
for things like syslog/email/etc
2016-07-14 09:27:15 -04:00
Jarrod Johnson
2dd6c31513 Fix deleted logs breaking partial buffer rebuild
When the read_recent_text ran off a cliff looking for buffer data,
it left the current textfile handle in a bad state.  This caused
the buffer rebuild to fail completely in a scenario where all the
current logs put together don't have enough data to satisfy the
buffer.  Fix this by making the handle more obviously broken, and
repairing while seeking out data.
2016-03-25 16:44:28 -04:00
Jarrod Johnson
6504acecad Change default log retention to be indefinite
Users have noted and complained that log data was lost, and didn't have old data.  This changes
the default behavior to be indefinite retention.  Users noting a lot of logs using space have a nice
intuitive indication of old files to delete, and the option remains for those to request a log expiration.
2016-03-21 09:57:23 -04:00
Jarrod Johnson
9d40c67974 Support walking back through multiple logs
The rollback support and replaydid not follow more than one log back.  Do the work to recurse
into older and older files, until big enough buffer or run out of files.
2016-03-13 19:50:02 -04:00
Jarrod Johnson
1f8bc635a8 Fix erroneous data injection to log replay
When a rollover event was detected, the offset
of the rollover event itself was being read
from the rolled file erroneously.  Skip to
next loop iteration so that the metadata about
the rollover event is properly ignored in building
the text data buffer.
2015-09-30 13:48:04 -04:00
Jarrod Johnson
f78a4d6074 Merge pull request #26 from jjohnson42/windowssupport
Support Windows management server
2015-09-30 10:19:54 -04:00
Jarrod Johnson
c50be7c3f2 Change rollover event to be JSON
The log format for other pieces of data is JSON.
Change the rollover event to be consistent.  Also
do not record the previous name of the log file,
as that isn't used, and the current filename is
likely to change when it too gets rolled over
so there's no practical use of knowing the
no longer valid name for the transaction.
2015-09-28 10:40:48 -04:00
Jarrod Johnson
45f62b5c05 Fix some issues around lock rework
Some scenarios were not accomodated correctly
as well as some references not set either.
2015-09-28 10:19:35 -04:00
Jarrod Johnson
a0e6e0b5c6 Merge branch 'windowssupport' of git://github.com/jjohnson42/confluent into jjohnson42-windowssupport
Additionally, rework locking back to not require any extra files
2015-09-28 09:56:03 -04:00
Jarrod Johnson
9975d57d5e Implement Locking in Windows log code
Under windows, we can't use flock.  However we can
get locking using msvcrt using different, but related
semantics.  Imitate whole file locking by just locking
first byte.  We have to make sure we seek() to the same
place when locking and unlocking, as Windows requires
the offset to be same for both operations.
2015-09-25 16:59:42 -04:00
chenglch
dc436fda74 Add log rotation support
Add TimedAndSizeRotatingFileHandler which mixes together
the RotatingFileHandler and TimedRotatingFileHandler from
python logging module to process the log data.

Add logrollover event to track the renamed information, so
that console session can read the log data from current log
file and last renamed file.

Global configuration is used by the log handler. The format
of the log section in '/etc/confluent/service.cfg' is like:
[log]
when = m
backup_count = 3
max_bytes = 8192
utc = False
2015-09-23 23:36:46 -04:00
Jarrod Johnson
a3dcf88749 Fix log path for windows
Under windows, the log files were not being written
as expected.
2015-09-23 11:48:29 -04:00
Jarrod Johnson
765c15ed5b Revert 'confluentd' change
After further investigation, the rename to confluentd was not
needed (after massaging pathex and using pip to install rather
than distutils).
2015-09-23 11:48:27 -04:00
Jarrod Johnson
29417d935c Phase 2 of Windows compatibility
More work to try to enable confluent to be frozen by
pyinstaller
2015-09-23 11:48:20 -04:00
Jarrod Johnson
b48cd8b685 Implement basic functionality under windows
Windows support by removing pid file, daemonizing, locking,
and other features.  Goal is to have a freezeable payload.
2015-09-23 11:48:17 -04:00
Jarrod Johnon
a366520670 Fix circular import problem
The change to allow configmanager to log traces
erroneously broke due to use of 'import .. as' in
circular imports.  Skip 'as' and the problem does not occur.
2015-01-21 14:22:53 -05:00
Jarrod Johnon
6acaac8644 Add one-call tracing to log-as-a-file
When a log object is used as a 'dumb' file target, show the origin of the
output.  The motivation here is that 'print' statements are intended to
be an unusual event that should be easily tracked down and eliminated
once their specific use has concluded.
In xcatd, running '-f' means a lot of mysterious output that is hard
to manage as they frequently print out variable contents without
searchable context.  For example, if in xcatd someone randomply prints out
a varibale with a nodename, we might see a stray:
n1
With this change (together with previous changes), the same statement
results in stdout log appearing like:
Jan 19 14:20:54   File "/opt/confluent/lib/python/confluent/plugins/hardwaremanagement/ipmi.py", line 364, in _dict_sensor
    print nodename: n1
2015-01-19 14:35:22 -05:00
Jarrod Johnon
522280d6be Fix numerous issues with recent enhancements
The buffer age was not working as intended
The fix to exit on error exited overly eagerly
The log replay failed to report a third value if file did not exist.
2014-10-28 16:45:55 -04:00
Jarrod Johnon
4443d67da6 Implement timestamp reporting
Have confetty include the vintage of incoming data so that user may know how likely the
data is relevant to now.
2014-10-06 15:13:09 -04:00
Jarrod Johnson
c5cb5649d5 Begin reorganizing content for packaging 2014-05-06 13:37:31 -04:00