A Kubernetes deployment solution for collecting syslog messages and forwarding them to Grafana Loki for centralized log management.
This project provides a complete pipeline for:
- Syslog Collection: RSyslog container that receives UDP/TCP syslog messages on port 514
- Log Forwarding: Grafana Agent configured to ship logs to Loki
- Container Management: Docker containerization with automated CI/CD
- Kubernetes Deployment: Complete K8s manifests with Flux GitOps automation
- Auto-Updates: Flux image automation for seamless deployments
The solution consists of:
- RSyslog Container - Receives and stores syslog messages
- Grafana Agent - Forwards logs from RSyslog to Loki
- Persistent Storage - 10GB PVC for log retention
- LoadBalancer Service - External access on port 514 (TCP/UDP)
- Kubernetes cluster with Flux v2 installed
- Grafana Loki instance running in
monitoringnamespace - Docker registry access (DockerHub)
-
Deploy via Flux GitOps:
kubectl apply -f flux-kustomization.yaml
-
Manual deployment:
kubectl apply -k .
- External IP: Configure in
service.yaml(currently set to192.168.0.141) - Storage: 10GB persistent volume using
default-retainstorage class - Loki Endpoint: Configured in
configmap.yamlto push to Loki gateway - Log Rotation: Automatic log rotation at 7.5MB using custom script
# Build locally
make build
# Build and publish
make publishThe project uses CircleCI for automated building and publishing:
- Triggers on
mainbranch commits - Builds Docker image using BuildKit
- Publishes to
ninjatec/rsyslogrepository - Current version:
1.0.13
Send test logs to verify functionality:
# TCP test
echo "Test message" | nc <external-ip> 514
# UDP test
echo "Test message" | nc -u <external-ip> 514Dockerfile- RSyslog container definitiondeployment.yaml- K8s deployment and PVCservice.yaml- LoadBalancer serviceconfigmap.yaml- Grafana Agent configurationkustomization.yaml- Kustomize resource manifestlog_rotation.sh- Log rotation scriptMakefile- Build and publish commands.circleci/config.yml- CI/CD pipeline
Logs are automatically forwarded to Grafana Loki at:
http://grafana-loki-gateway.monitoring.svc.cluster.local/loki/api/v1/push
Use Grafana to query and visualize the collected syslog data.
-
Check RSyslog container logs:
kubectl logs -n monitoring deployment/rsyslog
-
Verify service connectivity:
kubectl get svc -n monitoring rsyslog
-
Check Grafana Agent status:
kubectl logs -n monitoring deployment/grafana-agent-logs
- Make changes to the codebase
- Update version in
Makefile - Commit to
mainbranch - CircleCI will automatically build and deploy
- Flux will detect new image and update deployment