2022-11-06 13:04:16 +00:00
|
|
|
# logmower-shipper
|
|
|
|
|
|
|
|
Watches log directory for logs, and ships them to mongo.
|
|
|
|
|
|
|
|
- Running: `go run .`
|
|
|
|
- Building: `go build .`
|
|
|
|
|
|
|
|
## Files
|
2022-11-09 18:24:57 +00:00
|
|
|
0. `pkg/globals` defines globals. This is used for Prometheus namespace, and for forwarding static global CLI configuration with less clutter.
|
|
|
|
1. `main.go` serves `/metrics` and runs `watcher.go`.
|
|
|
|
2. `pkg/watcher` main routine; initializes (including `mongo.go`) and watches for new log files.
|
|
|
|
- `pkg/mongo` provides statically safe and central tools to interact with the database.
|
|
|
|
- `pkg/util` provides additional utility functions.
|
|
|
|
3. `pkg/file` handles file lifecycle; watches files and tails them, streaming lines to `pkg/lines`.
|
|
|
|
4. `pkg/lines` processes lines and streams them to `pkg/sender`.
|
|
|
|
5. `pkg/sender` batches lines and ships them to mongo.
|
2022-11-09 19:55:54 +00:00
|
|
|
|
|
|
|
## Skaffold
|
|
|
|
```bash
|
2022-11-09 21:57:47 +00:00
|
|
|
export NS=gitdbd-5cym5
|
2022-11-09 19:55:54 +00:00
|
|
|
kubectl apply -f k8s/dev/mongodb.yaml -n "$NS"
|
|
|
|
kubectl apply -f k8s/dev/prom.yaml -n "$NS"
|
|
|
|
skaffold dev --namespace "$NS"
|
|
|
|
|
|
|
|
hwatch kubectl get pods --namespace "$NS"
|
|
|
|
```
|