diff --git a/scripts/log-search b/scripts/log-search index 5f60b68c56..2e8e04d003 100755 --- a/scripts/log-search +++ b/scripts/log-search @@ -15,7 +15,7 @@ from scripts.lib.zulip_tools import BOLD, CYAN, ENDC, FAIL, GRAY, OKBLUE def parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser( - description="Search nginx logfiles for an IP or hostname, ignoring commonly-fetched URLs." + description="Search logfiles for an IP or hostname, ignoring commonly-fetched URLs." ) log_selection = parser.add_argument_group("File selection") log_selection_options = log_selection.add_mutually_exclusive_group() @@ -40,6 +40,12 @@ def parser() -> argparse.ArgumentParser: choices=range(0, 24), default=3, ) + log_selection.add_argument( + "--nginx", + "-N", + help="Parse from NGINX logs, not server.log", + action="store_true", + ) filtering = parser.add_argument_group("Filtering") filtering.add_argument("filter", help="IP address or hostname to search for") @@ -103,6 +109,36 @@ NGINX_LOG_LINE_RE = re.compile( re.X, ) +PYTHON_LOG_LINE_RE = re.compile( + r""" + (?P \d+-\d+-\d+ ) \s+ + (?P