diff --git a/lg.py b/lg.py
index c393853..c4dd040 100755
--- a/lg.py
+++ b/lg.py
@@ -29,13 +29,16 @@ def add_links(text):
ret_text = []
for line in text:
+ # Some heuristic to create link
if line.strip().startswith("BGP.as_path:") or \
line.strip().startswith("Neighbor AS:") :
ret_text.append(re.sub(r'(\d+)',r'\1',line))
else:
- line = re.sub(r'([a-zA-Z0-9\-]*\.([a-zA-Z]{2,3}){1,2})(\s|$)', r'\1',line)
+ line = re.sub(r'([a-zA-Z0-9\-]*\.([a-zA-Z]{2,3}){1,2})(\s|$)', r'\1\2',line)
line = re.sub(r'AS(\d+)', r'AS\1',line)
line = re.sub(r'(\d+\.\d+\.\d+\.\d+)', r'\1',line)
+ hosts = "/".join(request.path.split("/")[2:])
+ line = re.sub(r'\[(\w+)\s+((|\d\d\d\d-\d\d-\d\d\s)(|\d\d:)\d\d:\d\d|\w\w\w\d\d)\]', r'[\1 \2]' % hosts, line)
ret_text.append(line)
return "\n".join(ret_text)