Skip to main content
Glama

get_docker_logs

Retrieve Docker container logs from remote servers via SSH/SFTP to monitor application performance and troubleshoot issues.

Instructions

Raccourci pour récupérer les logs d'un container Docker.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasYesAlias du serveur cible.
containerYesNom ou ID du container Docker.
linesNoNombre de lignes à récupérer.
sinceNoLogs depuis (ex: '5m', '1h', '2024-01-01').
timestampsNoAfficher les timestamps.

Implementation Reference

  • Handler function that builds the 'docker logs' command based on parameters, queues an SSH job to execute it on the remote server, waits for completion, and returns the container logs.
    async (params) => { let cmd = `docker logs --tail ${params.lines}`; if (params.since) cmd += ` --since ${params.since}`; if (params.timestamps) cmd += ' --timestamps'; cmd += ` ${params.container}`; const job = queue.addJob({ type: 'ssh', alias: params.alias, cmd: cmd, streaming: false }); history.logTask(job); ssh.executeCommand(job.id); const finalJob = await waitForJobCompletion(job.id, config.syncTimeout); if (finalJob) { return { content: [{ type: "text", text: `🐳 Logs Docker (${params.container}) - ${finalJob.lineCount || 0} lignes:\n\n${finalJob.output || '(vide)'}` }] }; } else { return { content: [{ type: "text", text: `Tâche ${job.id} initiée en arrière-plan.` }] }; } } );
  • Input schema definition using Zod for validating tool parameters: server alias, container name/ID, optional lines, since, and timestamps.
    { title: "Récupérer les logs Docker", description: "Raccourci pour récupérer les logs d'un container Docker.", inputSchema: z.object({ alias: z.string().describe("Alias du serveur cible."), container: z.string().describe("Nom ou ID du container Docker."), lines: z.number().optional().default(100).describe("Nombre de lignes à récupérer."), since: z.string().optional().describe("Logs depuis (ex: '5m', '1h', '2024-01-01')."), timestamps: z.boolean().optional().default(false).describe("Afficher les timestamps.") }) },
  • server.js:736-766 (registration)
    Registration of the 'get_docker_logs' tool using McpServer.registerTool, including title, description, inputSchema, and inline handler function.
    server.registerTool( "get_docker_logs", { title: "Récupérer les logs Docker", description: "Raccourci pour récupérer les logs d'un container Docker.", inputSchema: z.object({ alias: z.string().describe("Alias du serveur cible."), container: z.string().describe("Nom ou ID du container Docker."), lines: z.number().optional().default(100).describe("Nombre de lignes à récupérer."), since: z.string().optional().describe("Logs depuis (ex: '5m', '1h', '2024-01-01')."), timestamps: z.boolean().optional().default(false).describe("Afficher les timestamps.") }) }, async (params) => { let cmd = `docker logs --tail ${params.lines}`; if (params.since) cmd += ` --since ${params.since}`; if (params.timestamps) cmd += ' --timestamps'; cmd += ` ${params.container}`; const job = queue.addJob({ type: 'ssh', alias: params.alias, cmd: cmd, streaming: false }); history.logTask(job); ssh.executeCommand(job.id); const finalJob = await waitForJobCompletion(job.id, config.syncTimeout); if (finalJob) { return { content: [{ type: "text", text: `🐳 Logs Docker (${params.container}) - ${finalJob.lineCount || 0} lignes:\n\n${finalJob.output || '(vide)'}` }] }; } else { return { content: [{ type: "text", text: `Tâche ${job.id} initiée en arrière-plan.` }] }; } } );

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/fkom13/mcp-sftp-orchestrator'

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