get_application_logs
Retrieve application logs with pattern detection and filtering by time range, search query, and severity level for monitoring and troubleshooting.
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 |
|---|---|---|---|
| project_id | Yes | ||
| app_id | Yes | ||
| from_timestamp | No | ||
| to_timestamp | No | ||
| query | No | ||
| severity | No |
Implementation Reference
- src/mcp_coroot/server.py:307-331 (handler)Primary MCP tool handler for get_application_logs, registered via @mcp.tool() decorator. Defines input schema via type hints and docstring, calls implementation function.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 (handler)Core handler implementation that encodes the app_id and invokes the CorootClient to fetch application logs from the API.@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 helper method that makes the HTTP request to the Coroot API endpoint for application logs.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
- src/mcp_coroot/server.py:315-328 (schema)Input schema and documentation for the get_application_logs tool, defining parameters and their descriptions."""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) """