delete_log_parsing_rule
Remove log parsing rules from New Relic monitoring to clean up log processing configurations and maintain organized log management.
Instructions
Delete a log parsing rule
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rule_id | Yes | ||
| account_id | No |
Input Schema (JSON Schema)
{
"properties": {
"account_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Account Id"
},
"rule_id": {
"title": "Rule Id",
"type": "string"
}
},
"required": [
"rule_id"
],
"type": "object"
}
Implementation Reference
- newrelic_mcp/server.py:717-734 (handler)MCP tool handler for deleting a log parsing rule. Decorated with @mcp.tool() for automatic registration and handles input validation, client checks, and delegates to the helper function.@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 (helper)Core helper function that executes the GraphQL mutation to delete the specified log parsing rule via New Relic's 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