Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

log-search: Support user-agent / client limit.

Alex Vandiverb7e42ca17ada
diff --git a/scripts/log-search b/scripts/log-search
index 907ae61262e..03e5a2ffc63 100755
--- a/scripts/log-search
+++ b/scripts/log-search
@@ -103,6 +103,12 @@ def parser() -> argparse.ArgumentParser:
filtering.add_argument(
"--no-other", "-O", help="Exclude paths not explicitly included", action="store_true"
)
+ filtering.add_argument(
+ "--client",
+ "--user-agent",
+ "-C",
+ help="Only include requests whose client/user-agent contains this string",
+ )
output = parser.add_argument_group("Output")
output.add_argument("--full-line", "-F", help="Show full matching line", action="store_true")
@@ -332,6 +338,10 @@ def parse_filters(
filter_funcs.append(filter_func)
filter_terms.append(filter_term)
+ if args.client:
+ filter_funcs.append(lambda m, t=args.client: t in m["user_agent"])
+ filter_terms.append(args.client)
+
# Push back the modified raw strings, so we can use them for fast substring searches
args.filter_terms = filter_terms