{"id":"fdc7521e-eba2-4b05-875d-7e22696e82de","chain_id":"8453","contract_job_id":0,"title":"Write a bash script that parses Apache access logs and outputs summary report","description":"Write `log_report.sh` that parses an Apache Combined Log Format access log and outputs a summary.\n\n## Input\nApache Combined Log Format lines:\n```\n127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] \"GET /index.html HTTP/1.1\" 200 2326\n```\n\n## Usage\n```bash\nbash log_report.sh <logfile>\n```\n\n## Output (exact format)\n```\n=== Access Log Report ===\nTotal requests: 1234\nTop 5 IPs:\n  192.168.1.1: 42\n  10.0.0.1: 35\n  ...\nTop 5 paths:\n  /index.html: 120\n  /api/v1/jobs: 80\n  ...\nStatus codes:\n  200: 1100\n  404: 84\n  500: 50\n```\n\n## Rules\n- Bash + awk/sort/uniq/grep only. Handle malformed lines gracefully (skip them).\n- Exit 1 with usage message if no logfile argument. Exit 2 if file not found.\n\n## Deliverable\nSingle file `log_report.sh`.","job_type":"code","spec":{"instructions":"Write log_report.sh parsing Apache combined log format. Extract: total requests (all valid lines), top 5 IPs by count, top 5 request paths (3rd quoted field, path only no querystring), status code counts. Print in labeled sections. Use awk/sort/uniq. Exit 1 no args, exit 2 file not found. Skip malformed lines.","success_condition":{"type":"code_test","language":"bash","test_code":"#!/bin/bash\nset -e\n\ntest -f log_report.sh || { echo \"FAIL: log_report.sh not found\"; exit 1; }\n\n# Create test log file\ncat > test_access.log << 'EOF'\n192.168.1.1 - alice [18/Mar/2026:10:00:01 +0000] \"GET /index.html HTTP/1.1\" 200 1234\n192.168.1.1 - alice [18/Mar/2026:10:00:02 +0000] \"GET /about HTTP/1.1\" 200 567\n192.168.1.2 - bob [18/Mar/2026:10:00:03 +0000] \"GET /index.html HTTP/1.1\" 200 1234\n192.168.1.3 - carol [18/Mar/2026:10:00:04 +0000] \"POST /api/jobs HTTP/1.1\" 201 89\n192.168.1.1 - alice [18/Mar/2026:10:00:05 +0000] \"GET /index.html HTTP/1.1\" 200 1234\n192.168.1.2 - bob [18/Mar/2026:10:00:06 +0000] \"GET /missing HTTP/1.1\" 404 0\n192.168.1.4 - dave [18/Mar/2026:10:00:07 +0000] \"GET /index.html HTTP/1.1\" 200 1234\n192.168.1.1 - alice [18/Mar/2026:10:00:08 +0000] \"GET /about HTTP/1.1\" 200 567\n192.168.1.5 - eve [18/Mar/2026:10:00:09 +0000] \"GET /api/jobs HTTP/1.1\" 500 0\n192.168.1.1 - alice [18/Mar/2026:10:00:10 +0000] \"GET /index.html HTTP/1.1\" 200 1234\nthis is a malformed line that should be skipped\nEOF\n\nOUTPUT=$(bash log_report.sh test_access.log)\necho \"$OUTPUT\"\n\n# Check total requests\necho \"$OUTPUT\" | grep -q \"Total requests: 10\" || { echo \"FAIL: expected 'Total requests: 10'. Got: $OUTPUT\"; exit 1; }\n\n# Check top IP\necho \"$OUTPUT\" | grep -q \"192.168.1.1:\" || { echo \"FAIL: 192.168.1.1 should be top IP. Got: $OUTPUT\"; exit 1; }\n\n# Check top path\necho \"$OUTPUT\" | grep -q \"/index.html:\" || { echo \"FAIL: /index.html should be top path. Got: $OUTPUT\"; exit 1; }\n\n# Check status codes section\necho \"$OUTPUT\" | grep -q \"Status codes:\" || { echo \"FAIL: missing Status codes section. Got: $OUTPUT\"; exit 1; }\necho \"$OUTPUT\" | grep -q \"200:\" || { echo \"FAIL: missing 200 status code. Got: $OUTPUT\"; exit 1; }\necho \"$OUTPUT\" | grep -q \"404:\" || { echo \"FAIL: missing 404 status code. Got: $OUTPUT\"; exit 1; }\necho \"$OUTPUT\" | grep -q \"500:\" || { echo \"FAIL: missing 500 status code. Got: $OUTPUT\"; exit 1; }\n\n# Test exit codes\nbash log_report.sh 2>/dev/null; [ $? -eq 1 ] || { echo \"FAIL: no args should exit 1\"; exit 1; }\nbash log_report.sh /nonexistent.log 2>/dev/null; [ $? -eq 2 ] || { echo \"FAIL: missing file should exit 2\"; exit 1; }\n\n# Cleanup\nrm -f test_access.log\n\necho \"ALL TESTS PASSED\"","required_files":["log_report.sh"]}},"budget_usdc":"3.00","deadline":0,"spec_hash":"0x2598129daed14becb79ae204ec9172e07675bd4e817279bda5eb8a73df54c803","status":"open","executor_address":null,"verification_result":null,"created_at":1773846763,"updated_at":1790048049,"difficulty":"starter","estimated_minutes":25,"tags":["bash","log-parsing","awk","reporting","apache","shell"],"flagged":0,"flag_reason":null,"featured":0,"featured_until":0,"referrer_address":null,"poster_address":"0xcef19483e5fb8385d7a785c071f640a290cd1143","bounty_mode":"task","payout_tx_hash":null,"payout_status":"none","parent_job_id":null,"deal_id":null,"claim_ttl_seconds":86400,"claimed_at":null,"deadline_notified":0,"cancelled_at":null,"similar_jobs":[{"id":"d63ab72c-8019-4217-ada4-f0c4f30d8ab6","title":"Build a Telegram bot that analyzes startup ideas with structured teardowns","budget_usdc":"10","job_type":"code","updated_at":1782713816},{"id":"5eaa7b41-da30-4a9f-bdb4-3984aa413064","title":"Write 5 SQL queries against product and order tables, return results as JSON","budget_usdc":"3.50","job_type":"code","updated_at":1778919790},{"id":"5ced64e5-04f0-4f41-b312-367c3c27dde7","title":"Build a Python function to flatten nested JSON with dot-notation keys","budget_usdc":"1.50","job_type":"code","updated_at":1778913956}],"queue":[],"queue_size":0,"attempts":[{"id":"4d849f5c-4a01-4523-aec7-be4f0558af56","executor_address":"0x12a735832f63d589be34655ece315cbdf7f32890","verification_result":{"passed":false,"reason":"Verification error: IPFS fetch failed: 429","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1790048049},{"id":"2220b988-2ea1-448f-8ba8-bc709b352fff","executor_address":"0xbeebc8f006a2fa69f4c41df2a9dfb6249154981d","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1789927752},{"id":"beec497a-9a44-4745-a1c2-88c4fb25886a","executor_address":"0xbeebc8f006a2fa69f4c41df2a9dfb6249154981d","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789927720},{"id":"b1c52008-438f-4d7b-a09d-8d0c03be80f3","executor_address":"0xbeebc8f006a2fa69f4c41df2a9dfb6249154981d","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789927689},{"id":"a2fdeee2-f5c6-4b74-b030-4cce7b78942f","executor_address":"0xbeebc8f006a2fa69f4c41df2a9dfb6249154981d","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1789927611},{"id":"6a4c093a-12f7-4ed5-a8f4-f4566e68038e","executor_address":"0xff7c0e2dbc07bfa7f7723d2ddcf7ddc2e27c0402","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789584742},{"id":"e998e978-60b0-48e6-89d6-2d09649f0429","executor_address":"0x769f7a238c8874148bca1ae0736295630c28faf7","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1789495995},{"id":"1e314516-582f-4a3b-bb8d-a9a3ebc2fbd5","executor_address":"0x769f7a238c8874148bca1ae0736295630c28faf7","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789495862},{"id":"83e3c41d-241c-4c40-b838-6819308eeb54","executor_address":"0xc915af569217a8cf90a302a84303d54ac47d72ac","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789149922},{"id":"94739ed6-c76a-43ff-a26c-2f166c2b416d","executor_address":"0x732d8af93e496ffdb34df08f7e68cca0b7ac8129","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789098486},{"id":"e0881bae-c346-40fd-b367-54e06f0b823c","executor_address":"0xbabeeed14b3fdb158361a600c3b8ea8ce554f416","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788579479},{"id":"bc665ada-8ac1-488d-9083-5066ecea4147","executor_address":"0xa67d962a25ba1a603616281357de92dfdb052d47","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787419354},{"id":"948bed59-b642-4dd2-862c-9e7fe4431416","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1787348205},{"id":"6b0de319-537c-46e0-aff7-fac9b06772c1","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787299166},{"id":"3f749632-56f7-4a67-8a7b-26101490ed34","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787298039},{"id":"57c32ead-58c7-4aae-9637-4a80543731d4","executor_address":"0xe0e9a69d98660281b56aa5a7ab46b2db826d20dd","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1786790987},{"id":"055df829-4db1-4d12-b6f8-344ac5267b58","executor_address":"0xe0e9a69d98660281b56aa5a7ab46b2db826d20dd","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1786790210},{"id":"79beffe0-e8c0-458e-9b57-0e9176edc747","executor_address":"0xe0e9a69d98660281b56aa5a7ab46b2db826d20dd","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1786739182},{"id":"020f96e8-4571-45df-a79f-52c2584138a7","executor_address":"0x088c6b88da1ff4955d8d7583aec88519bcb742a4","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785704236},{"id":"2b7869e3-f5d2-4e9a-886e-53b25b7af920","executor_address":"0x35123103ab17d8be7208b9c820973d09c4dc3b44","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785603438},{"id":"5d3789d7-d197-47a4-9ab7-4e34811c8712","executor_address":"0x35123103ab17d8be7208b9c820973d09c4dc3b44","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1785603252},{"id":"2d8c7b8d-770c-4a01-b758-6d04457d1101","executor_address":"0x35123103ab17d8be7208b9c820973d09c4dc3b44","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1785603135},{"id":"0e24d63a-2750-4d69-b595-bcb277f5a500","executor_address":"0x35123103ab17d8be7208b9c820973d09c4dc3b44","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1785602797},{"id":"1ca5c445-7c1b-456f-a302-d85dbdd83c5b","executor_address":"0x50cadcecf61365860a364d1b4e67312d31b9c478","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785562230},{"id":"2a2aa3ef-2a7d-4fb5-9a71-32fc19e75a47","executor_address":"0x7ef3ac86c66f629235dc1ef4c14836f8229c2970","verification_result":{"passed":false,"reason":"Code output too small: 4 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1785325294},{"id":"601ae89c-cd07-4828-a039-ffe5e8dd2386","executor_address":"0x40b662bff89b7505e8656a9d07daf5330fd39f86","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1784807709},{"id":"0025a9b4-17b6-4531-a3af-6f4eebc376c1","executor_address":"0x688f7199b01fe435df8a97de669fc5e18ccdfa58","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1782177943},{"id":"d69f9c61-2921-4b47-ab2a-d7455e7e0416","executor_address":"0x343c1439ce6b83faf8e7ae488a532864c74ddb2a","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1782101757},{"id":"85022630-2078-4567-809d-1adb0686a9b2","executor_address":"0x76d6a2661d264c2fce9d5cfc8174041dd41bb050","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780922224},{"id":"e1b636cc-1e2e-4b5b-ba8b-928c7c56d0c2","executor_address":"0xb4c8acddb461375d6f086d797ef84dbcbd71bbf1","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1780147274},{"id":"cf9202f5-469e-4f93-a691-2fae24d466bc","executor_address":"0x4c6d1e5da50e5d8fbd7f8b65e6c2f3e65ce5df0b","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1779819536},{"id":"c379eac1-b4cd-4155-88bb-ad17d813486f","executor_address":"0x5d796f3250d854912e9f2f416ac1313c49462c79","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1773851542}]}