{ "cells": [ { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "import re\n", "import pandas as pd\n", "\n", "# Function to extract log entries with specified pattern and check for 429 errors\n", "def extract_429_error_log_entries(file_path):\n", " with open(file_path, 'r') as file:\n", " log_entries = file.readlines()\n", " \n", " log_data = []\n", " pattern = re.compile(r'(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d{3}) - ERROR - tool_handler Tool call failed:')\n", " \n", " for i in range(len(log_entries)):\n", " entry = log_entries[i]\n", " match = pattern.match(entry)\n", " if match:\n", " # Check within the next 100 lines for a 429 error\n", " for j in range(i + 1, min(i + 100, len(log_entries))):\n", " if '
\n", " | Timestamp | \n", "Log Entry | \n", "429 Error Entry | \n", "
---|---|---|---|
0 | \n", "2024-06-25 06:39:01,261 | \n", "2024-06-25 06:39:01,261 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
1 | \n", "2024-06-25 06:39:03,968 | \n", "2024-06-25 06:39:03,968 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
2 | \n", "2024-06-25 06:39:06,904 | \n", "2024-06-25 06:39:06,904 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
3 | \n", "2024-06-25 07:52:06,830 | \n", "2024-06-25 07:52:06,830 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
4 | \n", "2024-06-25 07:52:09,671 | \n", "2024-06-25 07:52:09,671 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
5 | \n", "2024-06-25 07:52:33,216 | \n", "2024-06-25 07:52:33,216 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
6 | \n", "2024-06-25 07:52:35,952 | \n", "2024-06-25 07:52:35,952 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
7 | \n", "2024-06-25 07:54:39,687 | \n", "2024-06-25 07:54:39,687 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
8 | \n", "2024-06-25 07:54:42,478 | \n", "2024-06-25 07:54:42,478 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
9 | \n", "2024-06-25 07:57:06,539 | \n", "2024-06-25 07:57:06,539 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
10 | \n", "2024-06-25 08:14:07,060 | \n", "2024-06-25 08:14:07,060 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
11 | \n", "2024-06-25 08:14:10,071 | \n", "2024-06-25 08:14:10,071 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "
12 | \n", "2024-06-25 08:14:12,738 | \n", "2024-06-25 08:14:12,738 - ERROR - tool_handler... | \n", "<h1>429</h1> | \n", "