Commit Graph

49 Commits

Author SHA1 Message Date
Anders Kaseorg 3ec58fd3d5 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-20 18:16:27 -07:00
Anders Kaseorg 91ade25ba3 python: Simplify with str.removeprefix, str.removesuffix.
These are available in Python ≥ 3.9.
https://docs.python.org/3/library/stdtypes.html#str.removeprefix

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-09-03 12:30:16 -07:00
Anders Kaseorg 0fa5e7f629 ruff: Fix UP035 Import from `collections.abc`, `typing` instead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg 531b34cb4c ruff: Fix UP007 Use `X | Y` for type annotations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg e08a24e47f ruff: Fix UP006 Use `list` instead of `List` for type annotation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg 5af8dfda3e ruff: Fix FURB167 Use of regular expression alias.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-30 22:37:15 -07:00
Anders Kaseorg 82a9fd927b ruff: Fix E226 Missing whitespace around arithmetic operator.
This is a preview rule, not yet enabled by default.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-01 09:30:04 -08:00
Anders Kaseorg 865febb307 ruff: Fix RUF021 Parenthesize when chaining `and` and `or` together.
This is a preview rule, not yet enabled by default.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-01 09:30:04 -08:00
Alex Vandiver 175e61486e log-search: Auto-limit to the correct logfile when searching datetimes. 2024-02-27 17:04:03 -08:00
Alex Vandiver 9eaaacba52 log-search: Return the filter terms, rather than changing them.
This leaves `args.filter_terms` as the raw values the user specified,
before they may have been transformed to the shape that we use for
substring matching.
2024-02-27 17:04:03 -08:00
Alex Vandiver 39a7c5d106 log-search: Add datetime prefix limit. 2024-02-27 17:04:03 -08:00
Alex Vandiver 281b74a264 log-search: Factor out nginx date conversion. 2024-02-27 17:04:03 -08:00
Alex Vandiver bdc210702c log-search: Document HTTP method limits. 2024-02-27 17:04:03 -08:00
Alex Vandiver 2122780d41 log-search: Fix attempts to limit to events requests in Django logs. 2024-02-26 08:19:57 -08:00
Alex Vandiver b7e42ca17a log-search: Support user-agent / client limit. 2024-02-26 08:19:57 -08:00
Alex Vandiver 9ca0cd9bbd log-search: Remove old /report/ endpoints. 2024-02-26 08:19:57 -08:00
Anders Kaseorg 93198a19ed requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-01-29 10:41:54 -08:00
Alex Vandiver 5786a38cec log-search: Match against path without query parameters.
The nginx logs have query parameters; display them, but do not use
them for URL matching.
2024-01-26 09:02:00 -08:00
Anders Kaseorg 2665a3ce2b python: Elide unnecessary list wrappers.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-13 12:41:23 -07:00
Anders Kaseorg 81bd63cb46 ruff: Fix PIE808 Unnecessary `start` argument in `range`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-01 14:57:01 -07:00
Alex Vandiver 3bf83e8830 log-search: Prevent BrokenPipeError exceptions when run with `head`.
See https://docs.python.org/3/library/signal.html#note-on-sigpipe
2023-07-13 11:53:42 -07:00
Alex Vandiver 94495bef18 log-search: Filter out /error_tracing endpoints. 2023-05-05 14:45:46 -07:00
Alex Vandiver 7c023042cf puppet: Rotate access log files every day, not at 500M.
Since logrotate runs in a daily cron, this practically means "daily,
but only if it's larger than 500M."  For large installs with large
traffic, this is effectively daily for 10 days; for small installs, it
is an unknown amount of time.

Switch to daily logfiles, defaulting to 14 days to match nginx; this
can be overridden using a zulip.conf setting.  This makes it easier to
ensure that access logs are only kept for a bounded period of time.
2023-04-06 14:31:16 -04:00
Alex Vandiver f66d952c57 log-search: Support HTTP method limits. 2023-03-22 11:20:47 -07:00
Alex Vandiver b2666bf054 log-search: Compare lowered terms to lowered log line.
This allows us to search for upper-case things.
2023-03-22 11:20:47 -07:00
Alex Vandiver 95abcffb75 log-search: Fix precedence in no-color case. 2023-02-22 11:43:13 -08:00
Alex Vandiver 38b7ecff68 log-search: Add a --timeline option to show gaps and overlaps. 2023-02-21 11:10:24 -08:00
Alex Vandiver cfd9e56d1a log-search: Do no use color codes if output is not a TTY. 2023-02-21 11:10:24 -08:00
Anders Kaseorg 81a7c7502f requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-03 16:36:54 -08:00
Anders Kaseorg 443b974b3e python: Apply changes from pyupgrade.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-20 22:33:28 -07:00
Anders Kaseorg d104407531 log-search: Fix re.Match type annotations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-05 12:55:03 -07:00
Alex Vandiver 2b02722d16 log-search: Add a filter to exclude all lines not explicitly wanted. 2022-06-28 15:59:31 -07:00
Alex Vandiver 180565d8d6 log-search: Fix copy/paste-o in filtering for presence. 2022-06-28 15:59:31 -07:00
Alex Vandiver 258b658cc0 log-search: Allow multiple search terms.
This allows AND'ing multiple terms together.
2022-05-06 17:45:46 -07:00
Alex Vandiver bd73e7d411 log-search: Factor out argument parsing. 2022-05-06 17:45:46 -07:00
Alex Vandiver 8eab5f6931 log-search: Add status code search.
This moves log filename parsing after the filter parsing, as that can
now enable --nginx.
2022-05-06 17:45:46 -07:00
Alex Vandiver 0bad002c14 log-search: Factor out logfile name parsing. 2022-05-06 17:45:46 -07:00
Alex Vandiver 67e641f37d log-search: Add a filter by path. 2022-05-06 17:45:46 -07:00
Alex Vandiver df47c5a750 log-search: Update docs to include client-id as an option. 2022-05-06 17:45:46 -07:00
Alex Vandiver b1749259d4 log-search: Fix URLs for non-zulipchat.com hosts. 2022-05-06 17:45:46 -07:00
Alex Vandiver e3a65b1528 log-search: Some Django log lines do not include hostname. 2022-05-06 17:45:46 -07:00
Alex Vandiver fe17a4d6d0 log-search: Handle ^C more gracefully. 2022-05-06 17:45:46 -07:00
Alex Vandiver da4ae3ff24 log-search: Filter out user avatars. 2022-05-06 17:45:46 -07:00
Alex Vandiver d3ae7480cc log-search: Handle settings.LOGGING_SHOW_PID. 2022-05-06 17:45:46 -07:00
Alex Vandiver bd298ba753 log-search: Not all servers are in UTC. 2022-05-06 17:45:46 -07:00
Alex Vandiver 65b99377d2 log-search: Show duration. 2022-05-03 13:44:29 -07:00
Alex Vandiver 056895cc33 log-search: Search for user-ids. 2022-05-03 13:44:29 -07:00
Alex Vandiver b355a0a63e log-search: Default to searching python logfiles.
These have more accurate timestamps, and have user information --
but are harder to parse, and will not show requests when Django or
Tornado is stopped.
2022-05-03 13:44:29 -07:00
Alex Vandiver ba1237119c log-search: Add a tool to search nginx logs by IP/hostname.
This is a script to search nginx log files by server hostname or
client IP address, and output matching lines, all while skipping
common and less-interesting request lines.
2022-05-03 13:44:29 -07:00