configure_logs
Configure log collection settings for applications by setting log level filters and pattern exclusions to control which logs are processed.
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
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| app_id | Yes | ||
| enabled | Yes | ||
| level | No | ||
| excluded_patterns | No |
Implementation Reference
- src/mcp_coroot/server.py:2125-2149 (handler)Primary MCP tool handler for 'configure_logs'. Decorated with @mcp.tool() which registers the tool. Calls configure_logs_impl to perform the action. Input schema defined by parameters and docstring.@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)Helper implementation that builds the config dict from tool parameters and calls the CorootClient.configure_logs method, handling errors.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 logs for the 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)
- src/mcp_coroot/server.py:2125-2125 (registration)The @mcp.tool() decorator registers the configure_logs function as an MCP tool with the name 'configure_logs'.@mcp.tool()