INNER CODE UNIT · Python
json_start
lebinh/ngxtop · ngxtop/ngxtop.py:316
if json_start == -1:
continue
json_str = line[json_start:].strip()
# Basic check for complete JSON: should start with { and end with }
if not json_str.endswith('}'):
# Likely truncated line, skip it
continue
# Handle potential truncated JSON by trying to parse
entry = json.loads(json_str)
if 'request' not in entry:
continue
# Extract request info
req = entry.get('request', {})
method = req.get('method', '-')