Gogent is a distributed log analysis system that uses embedded NATS messaging and LLM-powered agents to process and analyze system logs in real-time and at the edge.
The motivation to do this was:
TODO: embed tools for agent common in IT and manufacturing support, such as: servicenow, jira, splunk, palantir foundry, etc.
flowchart subgraph Manufacturing Site Network S[IoT Error Log Producer 1] -->|Publish| Z T[IoT Error Log Producer 2] -->|Publish| Z Y[IoT Error Log Producer N] -->|Publish| Z subgraph Gogent subgraph embedded NATS Z@{ shape: das, label: "agent.technical.support" } U@{ shape: lin-cyl, label: "JetStream Persistence" } end Z -->|Subscribe| A{Agent Sig} E[(Error Log DB)] A --> |Retain w/ policy conditions| E end subgraph Inference Providers A -->|Request| L[LLM or VLM API] L -->|Response| A end end
agent.technical.support
subjectAGENT_STREAM
with AGENT_CONSUMER
subscriptiontype Config struct { APIKey string // Required for non-Ollama providers NATSUrl string AgentName string Instructions string Model string Provider string // LLM provider selection DBPath string // Path to SQLite database }
// NATS Configuration StreamName = "AGENT_STREAM" ConsumerName = "AGENT_CONSUMER" SubjectName = "agent.technical.support" NATSPort = 4222 NATSURL = "nats://localhost:4222" // Agent Configuration AgentName = "Agent Sig" Provider = "OLLAMA" // Default provider Model = "deepseek-r1:1.5b" // Default model
type LogMessage struct { Timestamp string Hostname string Severity string Service string Message string Context map[string]interface{} }
CREATE TABLE agent_logs ( id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp TEXT NOT NULL, hostname TEXT NOT NULL, severity TEXT NOT NULL, service TEXT NOT NULL, message TEXT NOT NULL, context TEXT, -- JSON string of context map analysis TEXT, -- AI-generated analysis created_at DATETIME DEFAULT CURRENT_TIMESTAMP );
git clone https://github.com/tobalo/gogent.git cd gogent
go mod download
cp .env.example .env
# LLM Provider Configuration PROVIDER=OLLAMA # See .env.example for all provider options MODEL=deepseek-r1:1.5b # Model name for selected provider API_KEY=your_key # Required for non-Ollama providers # Other configurations...
The easiest way to run Gogent is using Docker Compose, which sets up both Gogent and Ollama in a software-defined network:
docker-compose up -d
This will:
docker-compose logs -f
docker-compose down
If you prefer to run without Docker:
go run cmd/microlith/main.go
Messages can be published using the NATS CLI:
nats pub agent.technical.support '{ "timestamp": "2025-01-15T02:14:23.123Z", "hostname": "web-server-01", "severity": "ERROR", "service": "nginx", "message": "Failed to bind to port 80: Address already in use", "context": { "pid": 1234, "user": "www-data" } }'
You can query the stored logs using SQLite:
sqlite3 data/agent.db "SELECT timestamp, severity, message, analysis FROM agent_logs WHERE severity = 'ERROR' ORDER BY timestamp DESC LIMIT 5;"