Distributed Logging
$ curl -s https://memphisdev.github.io/memphis-docker/docker-compose.yml -o docker-compose.yml \
&& docker compose -f docker-compose.yml -p memphis up -d
$ docker run -d \
-p 5432:5432 \
-e POSTGRES_USER=gogger \
-e POSTGRES_PASSWORD=gogger1! \
-e POSTGRES_DB=gogger \
--name postgres postgres:alpine
$ cd ./consumer/ && go run ./cmd/server/
# 2024/01/28 23:13:12 INFO start consuming messages
$ cd ./producer/ && go run ./cmd/server/
# [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
#
# [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
# - using env: export GIN_MODE=release
# - using code: gin.SetMode(gin.ReleaseMode)
#
# [GIN-debug] POST /log/access --> github.com/Slowhigh/gogger/producer/infra/router.NewRouter.func1 (3 handlers)
# [GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
# Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
# [GIN-debug] Listening and serving HTTP on :5000
$ curl --location 'http://localhost:5000/log/access' \
--header 'Content-Type: application/json' \
--data '{
"timestamp": "2006-01-02T15:04:05Z",
"is_normal_mode": true,
"is_login": true,
"user_name": "john",
"device_name": "slowhigh",
"ip": "192.168.0.1"
}'
- initial account - id:
root
/ pw:memphis
- go to http://localhost:9000/stations/access-message