Graylog MCP Server
Provides direct access to Graylog logs with tools for searching, aggregating, analyzing, clustering, and managing logs, events, saved searches, and connections across multiple Graylog instances.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Graylog MCP Servershow me error logs from the last hour"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🔍 Graylog MCP Server
An MCP server that gives AI assistants direct access to your Graylog logs -- search, aggregate, analyze, and cluster log data through natural language.
What It Does
This server exposes your Graylog instance(s) as MCP tools, so AI assistants like Claude, Cursor, and others can query logs on your behalf. Instead of context-switching to the Graylog UI, you describe what you're looking for and the assistant handles the rest.
25 tools covering:
Log search -- full-text and field-filtered queries with pagination, exact/fuzzy matching, and configurable field selection
Contextual analysis -- fetch surrounding messages around a specific log entry
Aggregations -- histograms, field statistics, and two-dimensional field-over-time breakdowns
Log clustering -- group similar messages into structural templates using Drain3, with persistent template libraries per connection
Events -- search Graylog events, list event definitions and notifications
Saved searches -- save, list, and reuse query configurations
Multi-connection -- switch between Graylog instances (e.g., nonprod vs prod) within one session
Stream & field discovery -- list streams, discover distinct field values
Related MCP server: mcp-server-logs-sieve
Prerequisites
Node.js 18+
Graylog 6.x (tested on 6.2)
A Graylog API token (how to create one)
Installation
Via npx (recommended)
No installation needed. Configure your MCP client to run:
{
"mcpServers": {
"graylog": {
"command": "npx",
"args": ["graylog-mcp-server"]
}
}
}From source
git clone https://github.com/jagadeesh52423/graylog-mcp.git
cd graylog-mcp
npm installThen point your MCP client to the local entry point:
{
"mcpServers": {
"graylog": {
"command": "node",
"args": ["/absolute/path/to/graylog-mcp/src/index.js"]
}
}
}Configuration
Create ~/.graylog-mcp/config.json:
{
"connections": {
"nonprod": {
"baseUrl": "http://graylog-nonprod:9000",
"apiToken": "your_api_token"
},
"prod": {
"baseUrl": "http://graylog-prod:9000",
"apiToken": "your_prod_api_token",
"defaultFields": ["timestamp", "message", "level", "source", "PODNAME"]
}
},
"defaultFields": ["timestamp", "gl2_message_id", "source", "env", "level", "message", "logger_name"]
}Option | Scope | Description |
| Root | Named Graylog instances, each with |
| Root | Global default fields returned in search results |
| Connection | Per-connection override (takes priority over global) |
If no defaultFields are set, all fields (*) are returned.
Override the config path with the GRAYLOG_CONFIG_PATH environment variable:
{
"mcpServers": {
"graylog": {
"command": "npx",
"args": ["graylog-mcp-server"],
"env": {
"GRAYLOG_CONFIG_PATH": "/path/to/custom/config.json"
}
}
}
}MCP Client Config Locations
Client | Config file |
Claude Code |
|
Cursor |
|
Claude Desktop (macOS) |
|
Usage
Once connected, talk to your AI assistant naturally. Some examples:
Connect to nonprod and show me error logs from the last hourWhat are the top error sources in production over the past 6 hours?Show me a histogram of level 3 errors over the past day, broken down by hourCluster the last 1000 error messages and show me the top patternsShow me the messages surrounding log ID 01KH5PDR893AZJQBYJJ87AQTW5Time Ranges
Relative: 30m, 1h, 2d, 1w, 3M, 1y
Absolute: provide from/to as ISO timestamps (2024-01-15T09:00:00Z) or Unix millis.
Default is 15 minutes if unspecified.
Available Tools
Connection Management
Tool | Description |
| List configured Graylog connections |
| Switch to a named connection |
Log Search
Tool | Description |
| Search logs with query, filters, time range, pagination |
| Get messages around a specific log entry by ID or timestamp |
| List available Graylog streams |
| Discover distinct values for a field (top N by count) |
Aggregations
Tool | Description |
| Time-bucketed message counts |
| Group by field with metrics (count, sum, avg, min, max) |
| Two-dimensional: field values over time intervals |
| Debug helper for empty histogram results |
Log Clustering
Tool | Description |
| Group similar messages into structural templates (Drain3) |
| List learned templates for the active connection |
| Remove a template |
| Give a template a human-readable label |
| Export template library as JSON |
| Bulk import templates (merge or replace) |
Templates are persisted at ~/.graylog-mcp/templates/<connection>.json and improve over time as more messages are clustered.
Events
Tool | Description |
| Search Graylog events with filters |
| List event definitions |
| List event notifications |
Saved Searches
Tool | Description |
| Save a query configuration for reuse |
| List all saved searches |
| Retrieve a saved search by name |
| Delete a saved search |
Project Structure
src/
├── index.js Server bootstrap and request routing
├── config.js Connection config and field defaults
├── query.js Query building and Graylog API client
├── tools.js Tool schema definitions (25 tools)
├── timerange.js Flexible time range parsing
├── aggregations.js Histogram, field stats, time-series
├── events.js Graylog events API
├── saved-searches.js Persistent saved search store
├── clustering/
│ ├── index.js Strategy registry
│ ├── preprocess.js Message normalization and tokenization
│ ├── formatter.js Cluster response formatting
│ ├── template-store.js Per-connection template persistence
│ └── strategies/
│ └── drain3.js Drain3 log clustering algorithm
└── tools/
├── cluster-errors.js cluster_log_messages handler
└── template-mgmt.js Template CRUD handlersAdding a Clustering Algorithm
Create
src/clustering/strategies/<name>.jsimplementinghydrate,serialize, andcluster(seedrain3.js)Register it in
src/clustering/index.jsPass
algorithm: "<name>"tocluster_log_messages
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/jagadeesh52423/graylog-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server