configure_logs
Set up and manage log collection for an application by enabling/disabling collection, defining minimum log levels, and excluding specific patterns via regex on the MCP Server for Coroot.
Instructions
Configure log collection settings for an application.
Controls which logs are collected and processed, including log level filtering and pattern exclusions.
Args: project_id: The project ID app_id: The application ID enabled: Whether to enable log collection level: Optional minimum log level (debug, info, warn, error) excluded_patterns: Optional regex patterns to exclude
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| enabled | Yes | ||
| excluded_patterns | No | ||
| level | No | ||
| project_id | Yes |
Implementation Reference
- src/mcp_coroot/server.py:2125-2149 (handler)Primary MCP tool handler for 'configure_logs', including registration via @mcp.tool() decorator and input schema definition through parameters and docstring. Calls internal implementation.@mcp.tool() async def configure_logs( project_id: str, app_id: str, enabled: bool, level: str | None = None, excluded_patterns: list[str] | None = None, ) -> dict[str, Any]: """ Configure log collection settings for an application. Controls which logs are collected and processed, including log level filtering and pattern exclusions. Args: project_id: The project ID app_id: The application ID enabled: Whether to enable log collection level: Optional minimum log level (debug, info, warn, error) excluded_patterns: Optional regex patterns to exclude """ return await configure_logs_impl( project_id, app_id, enabled, level, excluded_patterns )
- src/mcp_coroot/server.py:2098-2123 (helper)Internal helper implementation that builds the configuration dictionary and invokes the CorootClient.configure_logs method, with error handling.async def configure_logs_impl( project_id: str, app_id: str, enabled: bool, level: str | None = None, excluded_patterns: list[str] | None = None, ) -> dict[str, Any]: """Implementation for configure_logs tool.""" try: client = get_client() config: dict[str, Any] = {"enabled": enabled} if level: config["level"] = level if excluded_patterns: config["excluded_patterns"] = excluded_patterns result = await client.configure_logs(project_id, app_id, config) return { "success": True, "message": "Log collection configuration updated successfully", "config": result, } except ValueError as e: return {"success": False, "error": str(e)} except Exception as e: return {"success": False, "error": f"Unexpected error: {str(e)}"}
- src/mcp_coroot/client.py:1596-1614 (helper)CorootClient method that performs the actual HTTP POST request to the Coroot API to configure log collection for the specified application.async def configure_logs( self, project_id: str, app_id: str, config: dict[str, Any] ) -> dict[str, Any]: """Configure log collection for an application. Args: project_id: The project ID app_id: The application ID config: Log collection configuration Returns: Dict containing updated configuration """ # URL encode the app_id in case it contains slashes encoded_app_id = quote(app_id, safe="") response = await self._request( "POST", f"/api/project/{project_id}/app/{encoded_app_id}/logs", json=config ) return self._parse_json_response(response)