A Kubernetes service that monitors workloads for specific annotations and sends filtered logs to Slack channels based on configurations.
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Kubernetes │ │ Slaking │ │ Slack │
│ Workloads │───▶│ Service │───▶│ Channels │
│ (with │ │ │ │ │
│ annotations) │ │ - Watcher │ │ - #alerts │
│ │ │ - Filter │ │ - #errors │
│ │ │ - Forwarder │ │ - #debug │
└─────────────────┘ └──────────────────┘ └─────────────────┘
Before installing from the Helm repository, ensure the GitHub Pages repository is set up:
gh-pages
branchmain
gh-pages
branch and publish the chartcharts/slaking/
directory# Check if the repository is available
curl https://elementtech.github.io/slaking/index.yaml
The easiest way to deploy Slaking is using the provided Helm chart from the GitHub Pages repository:
# Add the Helm repository
helm repo add slaking https://elementtech.github.io/slaking
helm repo update
# Install the chart
helm install slaking slaking/slaking \
--namespace slaking \
--create-namespace \
--set env.SLACK_TOKEN="xoxb-your-token" \
--set env.SLACK_DEFAULT_CHANNEL="#alerts"
Alternative: Install from local chart directory (if you have the source code):
# Quick deployment with automated script
./helm-deploy.sh
# Manual Helm deployment from local chart
helm install slaking ./charts/slaking \
--namespace slaking \
--create-namespace \
--set env.SLACK_TOKEN="xoxb-your-token" \
--set env.SLACK_DEFAULT_CHANNEL="#alerts"
Benefits of Helm deployment:
For users who prefer direct Kubernetes manifests:
# Deploy using vanilla manifests
./deploy.sh
# Or manually
kubectl apply -f k8s/
Add these annotations to your Kubernetes workloads:
metadata:
annotations:
slaking.enabled: "true"
slaking.channel: "#alerts"
slaking.filters: "error|exception|fatal"
slaking.level: "error"
slaking.include-labels: "app=myapp,environment=prod"
Annotation | Description | Default |
---|---|---|
slaking.enabled |
Enable log forwarding for this workload | false |
slaking.channel |
Slack channel to send logs to | #general |
slaking.filters |
Regex patterns to filter logs | .* |
slaking.level |
Minimum log level (debug, info, warn, error) | info |
slaking.include-labels |
Comma-separated key=value pairs to include | "" |
slaking.exclude-labels |
Comma-separated key=value pairs to exclude | "" |
slaking.max-lines |
Maximum lines per message | 10 |
slaking.cooldown |
Cooldown period between messages (seconds) | 60 |
# Add the Helm repository
helm repo add slaking https://elementtech.github.io/slaking
helm repo update
# Install with your Slack configuration
helm install slaking slaking/slaking \
--namespace slaking \
--create-namespace \
--set env.SLACK_TOKEN="xoxb-your-token" \
--set env.SLACK_DEFAULT_CHANNEL="#alerts"
# Clone and install dependencies
git clone https://github.com/ElementTech/slaking.git
cd slaking
npm install
# Set up environment variables
cp env.example .env
# Edit .env with your Slack token and other settings
# Deploy using automated script
./helm-deploy.sh
# Update the repository
helm repo update
# Check available versions
helm search repo slaking/slaking
# Upgrade to latest version
helm upgrade slaking slaking/slaking \
--namespace slaking \
--reuse-values
# Or upgrade to a specific version
helm upgrade slaking slaking/slaking \
--namespace slaking \
--version 1.0.1 \
--reuse-values
npm run dev
npm test
npm run build
GET /health
- Health checkGET /metrics
- Prometheus metricsPOST /config
- Update configurationGET /config
- Get current configurationGET /status
- Service statusThe service exposes Prometheus metrics at /metrics
for monitoring:
slaking_logs_processed_total
slaking_logs_filtered_total
slaking_slack_messages_sent_total
slaking_errors_total
Create a Grafana dashboard with these queries:
# Log processing rate
rate(slaking_logs_processed_total[5m])
# Error rate
rate(slaking_errors_total[5m])
# Active streams
slaking_active_streams
# Slack message rate
rate(slaking_slack_messages_sent_total[5m])
The Helm chart supports extensive configuration:
# values-production.yaml
replicaCount: 3
hpa:
enabled: true
maxReplicas: 5
serviceMonitor:
enabled: true
config:
slack:
defaultChannel: "#prod-alerts"
kubernetes:
namespaces: ["production", "staging"]
Create separate values files for different environments:
values-production.yaml
- Production settingsvalues-staging.yaml
- Staging settingsvalues-development.yaml
- Development settingsgh-pages
branchhttps://elementtech.github.io/slaking
Repository-based Helm deployment:
helm upgrade slaking slaking/slaking \
--namespace slaking \
--set env.LOG_LEVEL=debug \
--reuse-values
Local Helm deployment:
helm upgrade slaking ./charts/slaking \
--namespace slaking \
--set env.LOG_LEVEL=debug
# Test health endpoint
kubectl port-forward -n slaking svc/slaking 3000:3000
curl http://localhost:3000/health
# Test metrics endpoint
kubectl port-forward -n slaking svc/slaking-metrics 9090:9090
curl http://localhost:9090/metrics
# Check status
helm list -n slaking
kubectl get pods -n slaking
# View logs
kubectl logs -n slaking -l app=slaking
# Test deployment
kubectl port-forward -n slaking svc/slaking 3000:3000
curl http://localhost:3000/health
# Upgrade deployment
helm upgrade slaking slaking/slaking \
--namespace slaking \
--reuse-values
# Uninstall
helm uninstall slaking -n slaking
kubectl delete namespace slaking
# Check status
./helm-deploy.sh status
# View logs
./helm-deploy.sh logs
# Test deployment
./helm-deploy.sh test
# Upgrade deployment
./helm-deploy.sh upgrade
# Uninstall
./helm-deploy.sh uninstall
The service requires minimal permissions:
MIT