{"id":28955843,"url":"https://github.com/elementtech/slaking","last_synced_at":"2025-10-16T07:33:16.601Z","repository":{"id":300791562,"uuid":"1007190488","full_name":"ElementTech/slaking","owner":"ElementTech","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-23T16:56:05.000Z","size":154,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-23T16:59:45.430Z","etag":null,"topics":["alerts","k8s","kubernetes","logging","operator","slack"],"latest_commit_sha":null,"homepage":"https://elementtech.github.io/slaking/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ElementTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-23T15:45:59.000Z","updated_at":"2025-06-23T16:56:08.000Z","dependencies_parsed_at":"2025-06-23T17:11:39.051Z","dependency_job_id":null,"html_url":"https://github.com/ElementTech/slaking","commit_stats":null,"previous_names":["elementtech/slaking"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/ElementTech/slaking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementTech%2Fslaking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementTech%2Fslaking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementTech%2Fslaking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementTech%2Fslaking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElementTech","download_url":"https://codeload.github.com/ElementTech/slaking/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementTech%2Fslaking/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279165940,"owners_count":26117952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-16T02:00:06.019Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alerts","k8s","kubernetes","logging","operator","slack"],"created_at":"2025-06-23T20:11:51.163Z","updated_at":"2025-10-16T07:33:16.585Z","avatar_url":"https://github.com/ElementTech.png","language":"JavaScript","readme":"# 🦥 Slaking\n\n\u003e *\"The laziest Pokémon that monitors your Kubernetes workloads while you take a nap!\"*\n\n\u003cimg src=\"https://www.pokemon.com/static-assets/content-assets/cms2/img/pokedex/full/289.png\" alt=\"Slaking Pokémon\" width=\"200\" height=\"200\"\u003e\n\n```\n    ╭─────────────────────────────────────────────────────────────╮\n    │                                                             │\n    │  🦥 Slaking - Kubernetes Log Monitoring Service            │\n    │                                                             │\n    │  \"When your logs need attention, Slaking wakes up!\"        │\n    │                                                             │\n    ╰─────────────────────────────────────────────────────────────╯\n```\n\n*A Kubernetes service that monitors workloads for specific annotations and sends filtered logs to Slack channels based on configurations - just like how Slaking watches over its territory!*\n\n## 🎯 Features\n\n- **🦥 Workload Monitoring**: Like Slaking's keen senses, watches Kubernetes workloads (Pods, Deployments, StatefulSets, etc.) for specific annotations\n- **🔍 Log Filtering**: Filters logs based on configurable patterns and criteria - Slaking knows exactly what to look for!\n- **📱 Slack Integration**: Sends filtered logs to designated Slack channels - Slaking's way of communicating\n- **⚙️ Configuration Management**: Supports multiple configurations for different workloads and channels\n- **❤️ Health Monitoring**: Built-in health checks and metrics - Slaking stays healthy!\n- **📦 Helm Chart**: Complete Helm chart for easy deployment and management\n\n## 🏗️ Architecture\n\n```\n┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐\n│   Kubernetes    │    │    🦥 Slaking    │    │     Slack       │\n│   Workloads     │───▶│   Service        │───▶│   Channels      │\n│   (with         │    │                  │    │                 │\n│   annotations)  │    │  - Watcher       │    │  - #alerts      │\n│                 │    │  - Filter        │    │  - #errors      │\n│                 │    │  - Forwarder     │    │  - #debug       │\n└─────────────────┘    └──────────────────┘    └─────────────────┘\n```\n\n*Slaking's territory spans from your Kubernetes cluster to your Slack workspace!*\n\n## 🚀 Deployment Options\n\n### Option 1: Helm Chart (Recommended) 🦥\n\nThe easiest way to deploy Slaking is using the provided Helm chart from the GitHub Pages repository:\n\n#### Watch All Namespaces (Recommended)\n```bash\n# Add the Helm repository\nhelm repo add slaking https://elementtech.github.io/slaking\nhelm repo update\n\n# Install the chart - Wake up Slaking to watch ALL namespaces!\nhelm install slaking slaking/slaking \\\n  --namespace slaking \\\n  --create-namespace \\\n  --set env.SLACK_TOKEN=\"xoxb-your-token\" \\\n  --set env.SLACK_DEFAULT_CHANNEL=\"#alerts\" \\\n  --set env.K8S_WATCH_ALL_NAMESPACES=\"true\"\n```\n\n#### Watch Specific Namespaces Only\n```bash\n# Install the chart to watch specific namespaces only\nhelm install slaking slaking/slaking \\\n  --namespace slaking \\\n  --create-namespace \\\n  --set env.SLACK_TOKEN=\"xoxb-your-token\" \\\n  --set env.SLACK_DEFAULT_CHANNEL=\"#alerts\" \\\n  --set env.K8S_WATCH_ALL_NAMESPACES=\"false\" \\\n  --set env.K8S_NAMESPACES=\"production,staging,monitoring\"\n```\n\n**Alternative: Install from local chart directory (if you have the source code):**\n```bash\n# Quick deployment with automated script (watches all namespaces by default)\n./helm-deploy.sh\n\n# Manual Helm deployment from local chart\nhelm install slaking ./charts/slaking \\\n  --namespace slaking \\\n  --create-namespace \\\n  --set env.SLACK_TOKEN=\"xoxb-your-token\" \\\n  --set env.SLACK_DEFAULT_CHANNEL=\"#alerts\" \\\n  --set env.K8S_WATCH_ALL_NAMESPACES=\"true\"\n```\n\n**Benefits of Helm deployment:**\n- ✅ Easy configuration management\n- ✅ Environment-specific values files\n- ✅ Automatic RBAC setup\n- ✅ Prometheus ServiceMonitor integration\n- ✅ Horizontal Pod Autoscaler support\n- ✅ Ingress configuration\n- ✅ Comprehensive health checks\n- ✅ Easy upgrades and rollbacks\n\n### Option 2: Vanilla Kubernetes Manifests\n\nFor users who prefer direct Kubernetes manifests:\n\n```bash\n# Deploy using vanilla manifests\n./deploy.sh\n\n# Or manually\nkubectl apply -f k8s/\n```\n\n## ⚙️ Configuration\n\n### Workload Annotations\n\nAdd these annotations to your Kubernetes workloads - Slaking will watch for these signals:\n\n```yaml\nmetadata:\n  annotations:\n    slaking.enabled: \"true\"\n    slaking.channel: \"#alerts\"\n    slaking.filters: \"error|exception|fatal\"\n    slaking.level: \"error\"\n    slaking.include-labels: \"app=myapp,environment=prod\"\n```\n\n### Configuration Options\n\n| Annotation | Description | Default |\n|------------|-------------|---------|\n| `slaking.enabled` | Enable log forwarding for this workload | `false` |\n| `slaking.channel` | Slack channel to send logs to | `#general` |\n| `slaking.filters` | Regex patterns to filter logs | `.*` |\n| `slaking.level` | Minimum log level (debug, info, warn, error) | `info` |\n| `slaking.include-labels` | Comma-separated key=value pairs to include | `\"\"` |\n| `slaking.exclude-labels` | Comma-separated key=value pairs to exclude | `\"\"` |\n| `slaking.max-lines` | Maximum lines per message | `10` |\n| `slaking.cooldown` | Cooldown period between messages (seconds) | `60` |\n\n### Namespace Configuration\n\nSlaking supports two modes for watching Kubernetes namespaces:\n\n#### 🦥 Watch All Namespaces (Recommended)\nThis is the default and recommended configuration. Slaking will monitor all namespaces in your cluster and only process logs from workloads that have the `slaking.enabled: \"true\"` annotation.\n\n**Environment Configuration:**\n```bash\n# Set to watch all namespaces\nK8S_WATCH_ALL_NAMESPACES=true\n# Leave K8S_NAMESPACES empty or unset\n```\n\n**Helm Configuration:**\n```bash\nhelm install slaking slaking/slaking \\\n  --set env.K8S_WATCH_ALL_NAMESPACES=\"true\"\n```\n\n**Benefits:**\n- ✅ No need to specify namespaces manually\n- ✅ Automatically picks up new namespaces\n- ✅ Works with any workload regardless of namespace\n- ✅ Simpler configuration and maintenance\n\n#### 🎯 Watch Specific Namespaces Only\nFor environments where you want to limit Slaking's scope to specific namespaces (e.g., for security or performance reasons).\n\n**Environment Configuration:**\n```bash\n# Disable watching all namespaces\nK8S_WATCH_ALL_NAMESPACES=false\n# Specify namespaces to watch\nK8S_NAMESPACES=production,staging,monitoring\n```\n\n**Helm Configuration:**\n```bash\nhelm install slaking slaking/slaking \\\n  --set env.K8S_WATCH_ALL_NAMESPACES=\"false\" \\\n  --set env.K8S_NAMESPACES=\"production,staging,monitoring\"\n```\n\n**Use Cases:**\n- 🔒 Multi-tenant clusters where you want to isolate monitoring\n- 🚀 Performance optimization for large clusters\n- 🛡️ Security requirements that limit cross-namespace access\n\n## 🎮 Installation\n\n### Prerequisites\n\n- Kubernetes cluster (1.19+)\n- kubectl configured and connected to your cluster\n- Docker installed and running\n- Slack workspace with API access\n- Helm 3.0+ (for Helm deployment)\n\n### Quick Start\n\n1. **Install from Helm repository (Recommended):**\n   ```bash\n   # Add the Helm repository\n   helm repo add slaking https://elementtech.github.io/slaking\n   helm repo update\n   \n   # Install with your Slack configuration - Time to wake up Slaking!\n   # This will watch ALL namespaces by default\n   helm install slaking slaking/slaking \\\n     --namespace slaking \\\n     --create-namespace \\\n     --set env.SLACK_TOKEN=\"xoxb-your-token\" \\\n     --set env.SLACK_DEFAULT_CHANNEL=\"#alerts\" \\\n     --set env.K8S_WATCH_ALL_NAMESPACES=\"true\"\n   ```\n\n2. **Alternative: Local development setup:**\n   ```bash\n   # Clone and install dependencies\n   git clone https://github.com/ElementTech/slaking.git\n   cd slaking\n   npm install\n   \n   # Set up environment variables\n   cp env.example .env\n   # Edit .env with your Slack token and other settings\n   # By default, it will watch all namespaces\n   \n   # Deploy using automated script\n   ./helm-deploy.sh\n   ```\n\n3. **Configure your workloads with annotations and watch logs flow to Slack!** 🦥\n\n### Updating the Helm Chart\n\n```bash\n# Update the repository\nhelm repo update\n\n# Check available versions\nhelm search repo slaking/slaking\n\n# Upgrade to latest version (maintains current namespace configuration)\nhelm upgrade slaking slaking/slaking \\\n  --namespace slaking \\\n  --reuse-values\n\n# Upgrade and change to watch all namespaces\nhelm upgrade slaking slaking/slaking \\\n  --namespace slaking \\\n  --set env.K8S_WATCH_ALL_NAMESPACES=\"true\" \\\n  --reuse-values\n\n# Upgrade and change to watch specific namespaces only\nhelm upgrade slaking slaking/slaking \\\n  --namespace slaking \\\n  --set env.K8S_WATCH_ALL_NAMESPACES=\"false\" \\\n  --set env.K8S_NAMESPACES=\"production,staging\" \\\n  --reuse-values\n\n# Or upgrade to a specific version\nhelm upgrade slaking slaking/slaking \\\n  --namespace slaking \\\n  --version 1.0.1 \\\n  --reuse-values\n```\n\n## 🔌 API Endpoints\n\n- `GET /health` - Health check (Slaking's vital signs)\n- `GET /metrics` - Prometheus metrics (Slaking's stats)\n- `POST /config` - Update configuration\n- `GET /config` - Get current configuration\n- `GET /status` - Service status (includes namespace configuration)\n\n## 📊 Monitoring\n\nThe service exposes Prometheus metrics at `/metrics` for monitoring - Slaking's performance stats:\n- `slaking_logs_processed_total`\n- `slaking_logs_filtered_total`\n- `slaking_slack_messages_sent_total`\n- `slaking_errors_total`\n\n### Grafana Dashboard\n\nCreate a Grafana dashboard with these queries:\n\n```promql\n# Log processing rate\nrate(slaking_logs_processed_total[5m])\n\n# Error rate\nrate(slaking_errors_total[5m])\n\n# Active streams\nslaking_active_streams\n\n# Slack message rate\nrate(slaking_slack_messages_sent_total[5m])\n```\n\n## 🎯 Advanced Configuration\n\n### Helm Chart Configuration\n\nThe Helm chart supports extensive configuration:\n\n```yaml\n# values-production.yaml\nreplicaCount: 3\nhpa:\n  enabled: true\n  maxReplicas: 5\nserviceMonitor:\n  enabled: true\nconfig:\n  slack:\n    defaultChannel: \"#prod-alerts\"\n  kubernetes:\n    # Watch all namespaces (recommended)\n    watchAllNamespaces: true\n    namespaces: []\n    # OR watch specific namespaces only\n    # watchAllNamespaces: false\n    # namespaces: [\"production\", \"staging\"]\nenv:\n  SLACK_TOKEN: \"xoxb-your-token\"\n  K8S_WATCH_ALL_NAMESPACES: \"true\"\n  # K8S_NAMESPACES: \"production,staging\"  # Only needed if watchAllNamespaces: false\n```\n\n### Multi-Environment Setup\n\nCreate separate values files for different environments:\n\n- `values-production.yaml` - Production settings\n- `values-staging.yaml` - Staging settings  \n- `values-development.yaml` - Development settings\n\n## 🆘 Troubleshooting\n\n### Common Issues\n\n1. **No logs being sent to Slack**\n   - Check if annotations are properly set\n   - Verify Slack token and channel permissions\n   - Check service logs for errors\n\n2. **Too many messages**\n   - Adjust cooldown period\n   - Refine filter patterns\n   - Set appropriate log levels\n\n3. **Permission denied**\n   - Ensure proper RBAC configuration\n   - Check service account permissions\n\n4. **Helm repository not found (404 error)**\n   - Ensure GitHub Pages is enabled for the `gh-pages` branch\n   - Check that the chart-releaser action has run successfully\n   - Verify the repository URL is correct: `https://elementtech.github.io/slaking`\n   - Wait a few minutes after pushing changes for GitHub Pages to update\n\n### Debug Mode\n\n**Repository-based Helm deployment:**\n```bash\nhelm upgrade slaking slaking/slaking \\\n  --namespace slaking \\\n  --set env.LOG_LEVEL=debug \\\n  --reuse-values\n```\n\n**Local Helm deployment:**\n```bash\nhelm upgrade slaking ./charts/slaking \\\n  --namespace slaking \\\n  --set env.LOG_LEVEL=debug\n```\n\n### Testing Configuration\n\n```bash\n# Test health endpoint\nkubectl port-forward -n slaking svc/slaking 3000:3000\ncurl http://localhost:3000/health\n\n# Test metrics endpoint\nkubectl port-forward -n slaking svc/slaking-metrics 9090:9090\ncurl http://localhost:9090/metrics\n```\n\n## 🎮 Management Commands\n\n### Helm Deployment (Repository-based)\n\n```bash\n# Check status\nhelm list -n slaking\nkubectl get pods -n slaking\n\n# View logs\nkubectl logs -n slaking -l app=slaking\n\n# Test deployment\nkubectl port-forward -n slaking svc/slaking 3000:3000\ncurl http://localhost:3000/health\n\n# Upgrade deployment\nhelm upgrade slaking slaking/slaking \\\n  --namespace slaking \\\n  --reuse-values\n\n# Uninstall\nhelm uninstall slaking -n slaking\nkubectl delete namespace slaking\n```\n\n### Helm Deployment (Local chart)\n\n```bash\n# Check status\n./helm-deploy.sh status\n\n# View logs\n./helm-deploy.sh logs\n\n# Test deployment\n./helm-deploy.sh test\n\n# Upgrade deployment\n./helm-deploy.sh upgrade\n\n# Uninstall\n./helm-deploy.sh uninstall\n```\n\n## 🔒 Security Considerations\n\n### RBAC Permissions\n\nThe service requires minimal permissions:\n- Read access to pods and their logs\n- Watch access to deployments, statefulsets, daemonsets\n- Read access to namespaces\n\n### Network Security\n\n- Service runs on ClusterIP by default\n- Metrics endpoint is separate for Prometheus scraping\n- No external access required\n\n### Secret Management\n\n- Slack token is stored in Kubernetes Secret\n- Consider using external secret management (HashiCorp Vault, AWS Secrets Manager, etc.)\n\n---\n\n```\n    🦥 Slaking says: \"Thanks for choosing me as your Kubernetes monitor!\"\n    \n    \"When your logs need attention, I'll be there to help!\"\n```\n\n## 📄 License\n\nMIT \n\n---\n\n*Made with ❤️ by the Slaking team - Because even the laziest Pokémon can be the most reliable!* 🦥 ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felementtech%2Fslaking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felementtech%2Fslaking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felementtech%2Fslaking/lists"}