An open API service indexing awesome lists of open source software.

https://github.com/ibero-data/glintlog

Self-Hosted Observability Platform - Build Glintlog, a self-hosted observability platform that provides a 90% cheaper alternative to other tools. It uses DuckDB for storage (140x compression vs Elasticsearch) and accepts logs via OpenTelemetry Protocol (OTLP)
https://github.com/ibero-data/glintlog

Last synced: 16 days ago
JSON representation

Self-Hosted Observability Platform - Build Glintlog, a self-hosted observability platform that provides a 90% cheaper alternative to other tools. It uses DuckDB for storage (140x compression vs Elasticsearch) and accepts logs via OpenTelemetry Protocol (OTLP)

Awesome Lists containing this project

README

          

# Glintlog

Self-hosted log aggregation. Single binary. No dependencies.

## Install

```bash
curl -fsSL https://raw.githubusercontent.com/ibero-data/glintlog/main/scripts/install.sh | bash
```

## Run

```bash
glintlog
```

Open http://localhost:8080 - Go through the initial setup, on onboarding page.

## Ports

| Port | Protocol | Purpose |
|------|----------|---------|
| 8080 | HTTP | Web UI + REST API |
| 4317 | gRPC | OTLP gRPC ingestion |
| 4318 | HTTP | OTLP HTTP ingestion |

## Sending Logs

Configure your OpenTelemetry SDK to send logs to:
- **gRPC**: `localhost:4317`
- **HTTP**: `http://localhost:4318/v1/logs`

Example with curl:
```bash
curl -X POST http://localhost:4318/v1/logs \
-H "Content-Type: application/json" \
-d '{
"resourceLogs": [{
"resource": {
"attributes": [
{"key": "service.name", "value": {"stringValue": "my-app"}}
]
},
"scopeLogs": [{
"logRecords": [{
"timeUnixNano": "'$(date +%s)000000000'",
"severityNumber": 9,
"severityText": "INFO",
"body": {"stringValue": "Hello from my app!"}
}]
}]
}]
}'
```

## API Reference

All API endpoints (except `/health` and auth) require a Bearer token.

### Authentication

```bash
# Login - get your tokens
curl -X POST http://localhost:8080/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":""}'

# Use the token
TOKEN="eyJhbG..."
curl http://localhost:8080/api/v1/logs \
-H "Authorization: Bearer $TOKEN"
```

### Endpoints

| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| `/health` | GET | No | Health check |
| `/api/v1/auth/login` | POST | No | Login, get tokens |
| `/api/v1/auth/refresh` | POST | No | Refresh access token |
| `/api/v1/auth/logout` | POST | Yes | Logout, invalidate session |
| `/api/v1/auth/me` | GET | Yes | Get current user |
| `/api/v1/logs` | GET | Yes | Query logs |
| `/api/v1/logs/tail` | GET | Yes | Live tail (SSE) |
| `/api/v1/services` | GET | Yes | List services |
| `/api/v1/stats` | GET | Yes | Get statistics |
| `/api/v1/admin/metrics` | GET | Admin | System metrics (CPU, RAM, etc.) |
| `/api/v1/admin/storage` | GET | Admin | Database info |
| `/api/v1/admin/logs` | DELETE | Admin | Delete logs by date range |

### Query Parameters for /api/v1/logs

| Parameter | Type | Description |
|-----------|------|-------------|
| `start` | string | Start timestamp (RFC3339) |
| `end` | string | End timestamp (RFC3339) |
| `service` | string | Filter by service name |
| `severity` | string | Filter by severity (DEBUG, INFO, WARN, ERROR, FATAL) |
| `search` | string | Full-text search on body |
| `limit` | int | Max results (default: 100, max: 10000) |
| `offset` | int | Pagination offset |

## Troubleshooting

### "database locked" error

Another Glintlog instance is running. Kill it first:
```bash
pkill glintlog
```

### Forgot admin password

Reset everything and get new credentials:
```bash
pkill glintlog
rm -rf ./data
glintlog
```

### Port already in use

Find what's using the port:
```bash
lsof -i:8080
```

Kill it or change Glintlog's port:
```bash
GLINTLOG_HTTP_PORT=9090 glintlog
```

### "invalid authorization header" error

You need to login first and use the token:
```bash
TOKEN=$(curl -s -X POST http://localhost:8080/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"email@email.com","password":"YOUR_PASSWORD"}' | jq -r '.tokens.access_token')

curl http://localhost:8080/api/v1/logs -H "Authorization: Bearer $TOKEN"
```

## Building from Source

Requires Go 1.21+ and Bun.

```bash
git clone https://github.com/ibero-data/glintlog.git
cd glintlog
make build
./glintlog
```

## License

GNU General Public License v3.0