Skip to main content
Glama

get_logs

Retrieve pod logs from Kubernetes clusters to monitor application performance, debug issues, and analyze container behavior.

Instructions

Get the logs of a specific pod

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
namespaceNodefault
tailNo

Implementation Reference

  • The handler function for the 'get_logs' tool. It uses kubectl to fetch the last 'tail' lines of logs from the specified pod in the given namespace. Returns the logs or an error message.
    @mcp.tool() async def get_logs(name: str, namespace: str = "default", tail: int = 1000) -> dict: """Get the logs of a specific pod""" try: cmd = ["kubectl", "logs", name, "-n", namespace, "--tail", str(tail)] result = subprocess.run(cmd, capture_output=True, text=True, check=True) return {"logs": result.stdout} except subprocess.CalledProcessError as e: return {"error": f"Failed to get logs: {str(e)}"}

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/abhijeetka/mcp-k8s-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server