get_application_logs
Retrieve and analyze application logs with pattern detection via time range, search query, and severity level filters to streamline troubleshooting and monitoring processes.
Instructions
Get application logs with pattern analysis.
Retrieves application logs with automatic pattern detection and grouping. Supports filtering by time range, search query, and severity level.
Args: project_id: Project ID app_id: Application ID (format: namespace/kind/name) from_timestamp: Start timestamp (optional) to_timestamp: End timestamp (optional) query: Log search query (optional) severity: Filter by severity level (optional)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| from_timestamp | No | ||
| project_id | Yes | ||
| query | No | ||
| severity | No | ||
| to_timestamp | No |
Implementation Reference
- src/mcp_coroot/server.py:306-331 (handler)Primary MCP handler and registration for the 'get_application_logs' tool using @mcp.tool() decorator. Includes schema via type hints and docstring. Thin wrapper around helper implementation.@mcp.tool() async def get_application_logs( project_id: str, app_id: str, from_timestamp: int | None = None, to_timestamp: int | None = None, query: str | None = None, severity: str | None = None, ) -> dict[str, Any]: """Get application logs with pattern analysis. Retrieves application logs with automatic pattern detection and grouping. Supports filtering by time range, search query, and severity level. Args: project_id: Project ID app_id: Application ID (format: namespace/kind/name) from_timestamp: Start timestamp (optional) to_timestamp: End timestamp (optional) query: Log search query (optional) severity: Filter by severity level (optional) """ return await get_application_logs_impl( # type: ignore[no-any-return] project_id, app_id, from_timestamp, to_timestamp, query, severity )
- src/mcp_coroot/server.py:284-304 (helper)Helper implementation that URL-encodes app_id and calls the CorootClient.get_application_logs method.@handle_errors async def get_application_logs_impl( project_id: str, app_id: str, from_timestamp: int | None = None, to_timestamp: int | None = None, query: str | None = None, severity: str | None = None, ) -> dict[str, Any]: """Get application logs.""" # URL encode the app_id since it contains slashes encoded_app_id = quote(app_id, safe="") logs = await get_client().get_application_logs( project_id, encoded_app_id, from_timestamp, to_timestamp, query, severity ) return { "success": True, "logs": logs, }
- src/mcp_coroot/client.py:386-424 (helper)CorootClient method that executes the actual HTTP request to fetch application logs from the Coroot API server.async def get_application_logs( self, project_id: str, app_id: str, from_timestamp: int | None = None, to_timestamp: int | None = None, query: str | None = None, severity: str | None = None, ) -> dict[str, Any]: """Get application logs. Args: project_id: Project ID. app_id: Application ID. from_timestamp: Start timestamp. to_timestamp: End timestamp. query: Log search query. severity: Filter by severity level. Returns: Application logs and patterns. """ params = {} if from_timestamp: params["from"] = str(from_timestamp) if to_timestamp: params["to"] = str(to_timestamp) if query: params["query"] = query if severity: params["severity"] = severity response = await self._request( "GET", f"/api/project/{project_id}/app/{app_id}/logs", params=params, ) data: dict[str, Any] = response.json() return data