1
0
Fork 0

Fixing time handling on handover and handling of Filerotate-param in MMDVM.ini

See logtailer.ini
main
Kim Huebel 4 years ago
parent 490977c3db
commit 78fcfb691f

@ -2,6 +2,12 @@
Host=0.0.0.0 Host=0.0.0.0
Port=5678 Port=5678
# This defines the maximum amount of loglines to be sent on initial opening of the dashboard
MaxLines=500
# Keep this parameter synchrone to Filerotate in YSFReflector.ini - if 0 then False, if 1 then True
Filerotate=True
[MMDVMHost] [MMDVMHost]
Logdir=/mnt/ramdisk/ Logdir=/mnt/ramdisk/
Prefix=MMDVM Prefix=MMDVM

@ -81,7 +81,7 @@ async def view_log(websocket, path):
raise ValueError('Fail to parse URL', format(path)) raise ValueError('Fail to parse URL', format(path))
path = os.path.abspath(parse_result.path) path = os.path.abspath(parse_result.path)
now = datetime.datetime.now() now = datetime.datetime.now(datetime.timezone.utc)
year = str(now.year) year = str(now.year)
month = str(now.month) month = str(now.month)
if len(month) == 1: if len(month) == 1:
@ -92,9 +92,15 @@ async def view_log(websocket, path):
file_path = "" file_path = ""
if path == "/MMDVM": if path == "/MMDVM":
if config['DEFAULT']['Filerotate'] == "True":
file_path = config['MMDVMHost']['Logdir']+config['MMDVMHost']['Prefix']+"-"+year+"-"+month+"-"+day+".log" file_path = config['MMDVMHost']['Logdir']+config['MMDVMHost']['Prefix']+"-"+year+"-"+month+"-"+day+".log"
else:
file_path = config['MMDVMHost']['Logdir']+config['MMDVMHost']['Prefix']+".log"
elif path == "/DAPNET": elif path == "/DAPNET":
if config['DEFAULT']['Filerotate'] == "True":
file_path = config['DAPNETGateway']['Logdir']+config['DAPNETGateway']['Prefix']+"-"+year+"-"+month+"-"+day+".log" file_path = config['DAPNETGateway']['Logdir']+config['DAPNETGateway']['Prefix']+"-"+year+"-"+month+"-"+day+".log"
else:
file_path = config['DAPNETGateway']['Logdir']+config['DAPNETGateway']['Prefix']+".log"
if path == "/MMDVM" or path == "/DAPNET": if path == "/MMDVM" or path == "/DAPNET":
logging.info(file_path) logging.info(file_path)
@ -102,7 +108,7 @@ async def view_log(websocket, path):
raise ValueError('File not found', format(file_path)) raise ValueError('File not found', format(file_path))
with open(file_path, newline = '\n', encoding="utf8", errors='ignore') as f: with open(file_path, newline = '\n', encoding="utf8", errors='ignore') as f:
content = ''.join(deque(f)) content = ''.join(deque(f, 2))
content = conv.convert(content, full=False) content = conv.convert(content, full=False)
lines = content.split("\n") lines = content.split("\n")
for line in lines: for line in lines:

Loading…
Cancel
Save