From 329b28dc26c976985836be31f0a150b5a639ec8b Mon Sep 17 00:00:00 2001 From: fly6516 Date: Mon, 14 Apr 2025 01:46:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=9E=90=EF=BC=9A=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5URL=E5=88=86=E6=9E=90=E5=8A=9F=E8=83=BD-=20?= =?UTF-8?q?=E4=BB=8E=E6=97=A5=E5=BF=97=E4=B8=AD=E7=AD=9B=E9=80=89=E5=87=BA?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E7=A0=81=E9=9D=9E200=E7=9A=84=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=20-=20=E7=BB=9F=E8=AE=A1=E6=AF=8F=E4=B8=AAURL?= =?UTF-8?q?=E7=9A=84=E5=A4=B1=E8=B4=A5=E6=AC=A1=E6=95=B0=20-=20=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=A4=B1=E8=B4=A5=E6=AC=A1=E6=95=B0=E6=9C=80=E5=A4=9A?= =?UTF-8?q?=E7=9A=84=E5=89=8D10=E4=B8=AAURL=20-=E6=89=93=E5=8D=B0=E7=BB=93?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1-1.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 1-1.py diff --git a/1-1.py b/1-1.py new file mode 100644 index 0000000..f08f1af --- /dev/null +++ b/1-1.py @@ -0,0 +1,11 @@ +from log_analysis_step2 import access_logs + +not200 = access_logs.filter(lambda log: log.response_code != 200) + +endpointCountPairTuple = not200.map(lambda log: (log.endpoint, 1)) + +endpointSum = endpointCountPairTuple.reduceByKey(lambda a, b : a + b) + +topTenErrURLs = endpointSum.takeOrdered(10, lambda s: -1 * s[1]) + +print('Top Ten failed URLs: %s' % topTenErrURLs)