always don’t work
i would force logwatch to parse all log ( old and new ) from the beginning in every check. it doesn’t matter if i’ve many alert because it’s my need.
This is not possible without modifying the mk_logwatch script.
The option “fromstart” is only relevant for new files seen the first time by the script.
If you want to modify the mk_logwatch, then you need to set the for every file to “None” and also set the “fromstart” option.
Here are the relevant lines from the script.
try:
header = "[[[%s]]]\n" % section.name_write
file_id, size = get_file_info(section.name_fs)
prev_file_id = filestate.get("inode", -1)
filestate["inode"] = file_id
# Look at which file offset we have finished scanning the logfile last time.
offset = filestate.get("offset")
# Set the current pointer to the file end
filestate["offset"] = size
# If we have never seen this file before, we do not want
# to make a fuss about ancient log messages... (unless configured to)
if offset is None and not (section.options.fromstart or debug):
return header, []
If you comment the line offset = filestate.get("offset") and write instead offset = None. It should work like you expect.
But then you have every time this behavior on this machine. Better would be to implement a new option to ignore any offset.
try:
header = u"[[[%s]]]\n" % section.name_write
stat = os.stat(section.name_fs)
inode = stat.st_ino if is_inode_capable(section.name_fs) else 1
# If we have never seen this file before, we set the inode to -1
prev_inode = filestate.get('inode', -1)
filestate['inode'] = file_id
# Look at which file offset we have finished scanning the logfile last time.
#offset = filestate.get('offset')
offset = None
# Set the current pointer to the file end
filestate['offset'] = size
You are sure that the indentation is correct? The code looks strange to me.
The output looks more like a stack trace and not a valid output from the script.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.