System/Log Files - add "Service Log (this boot)" including parser as an option to provide access to entries collected in https://github.com/opnsense/core/issues/6099 (proposal for 23.1)

This commit is contained in:
Ad Schellevis 2022-12-19 10:06:54 +01:00
parent 20b25258ff
commit 6f46fe3080
2 changed files with 18 additions and 0 deletions

View File

@ -95,6 +95,7 @@
<Backend url="/ui/diagnostics/log/core/configd"/>
<General url="/ui/diagnostics/log/core/system"/>
<WebGUI VisibleName="Web GUI" url="/ui/diagnostics/log/core/lighttpd"/>
<ServiceLog VisibleName="Service Log (this boot)" url="/ui/diagnostics/log/core/boot"/>
</LogFiles>
<Diagnostics order="160" cssClass="fa fa-medkit fa-fw">
<Services url="/status_services.php">

View File

@ -61,6 +61,23 @@ class SysLogFormat(NewBaseLogFormat):
return response[:tmp].strip().split()[-1] if tmp > -1 else ""
class ServiceLogFormat(NewBaseLogFormat):
def __init__(self, filename):
super(ServiceLogFormat, self).__init__(filename)
@staticmethod
def match(line):
return len(line) > 25 and line[19] == '+' and re.match(r'\d{4}(.\d{2}){2}(\s|T)(\d{2}.){2}\d{2}', line[0:19])
@property
def timestamp(self):
return self._line[0:19]
@property
def line(self):
return self._line[26:]
class SysLogFormatEpoch(NewBaseLogFormat):
def __init__(self, filename):
super(SysLogFormatEpoch, self).__init__(filename)