delete_log_parsing_rule
Remove a log parsing rule from New Relic to stop processing logs according to specific patterns.
Instructions
Delete a log parsing rule
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rule_id | Yes | ||
| account_id | No |
Implementation Reference
- newrelic_mcp/server.py:717-734 (registration)MCP tool registration and handler for 'delete_log_parsing_rule'. Validates inputs, initializes client/account, calls core delete function from log_parsing module, and formats response as JSON.@mcp.tool() async def delete_log_parsing_rule( rule_id: str, account_id: Optional[str] = None ) -> str: """Delete a log parsing rule""" if not client: return json.dumps({"error": "New Relic client not initialized"}) acct_id = account_id or client.account_id if not acct_id: return json.dumps({"error": "Account ID required but not provided"}) try: success = await log_parsing.delete_log_parsing_rule(client, acct_id, rule_id) return json.dumps({"success": success}, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
- newrelic_mcp/log_parsing.py:520-544 (handler)Core handler function that executes the GraphQL mutation to delete the specified log parsing rule using the New Relic NerdGraph API.async def delete_log_parsing_rule(client, account_id: str, rule_id: str) -> bool: """Delete a log parsing rule""" mutation = f""" mutation {{ logConfigurationsDeleteParsingRule( accountId: {int(account_id)}, id: "{rule_id}" ) {{ errors {{ message type }} }} }} """ result = await client.nerdgraph_query(mutation) if result and "data" in result: delete_result = result["data"].get("logConfigurationsDeleteParsingRule", {}) if delete_result.get("errors"): raise Exception(f"Failed to delete rule: {delete_result['errors']}") return True return False