12 lines
365 B
Python
12 lines
365 B
Python
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)
|