Add ip and query params in fiber logger (#1268)

Co-authored-by: walker-16 <agpazos85@gmail.com>
This commit is contained in:
ftocal 2024-04-01 16:06:43 -03:00 committed by GitHub
parent f635f1d785
commit 451c48a670
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -4,7 +4,6 @@ import (
"context"
_ "embed"
"fmt"
"github.com/wormhole-foundation/wormhole-explorer/api/handlers/protocols"
"net/http"
"os"
"os/signal"
@ -12,6 +11,8 @@ import (
"syscall"
"time"
"github.com/wormhole-foundation/wormhole-explorer/api/handlers/protocols"
frs "github.com/XLabs/fiber-redis-storage"
"github.com/ansrivas/fiberprometheus/v2"
"github.com/go-redis/redis/v8"
@ -196,7 +197,7 @@ func main() {
app.Use(requestid.New())
app.Use(logger.New(logger.Config{
Format: "level=info timestamp=${time} method=${method} path=${path} latency=${latency} status${status} request_id=${locals:requestid}\n",
Format: "level=info timestamp=${time} method=${method} path=${path} latency=${latency} status${status} request_id=${locals:requestid} ip=${ips} queryParams=${queryParams}\n",
Next: func(c *fiber.Ctx) bool {
path := c.Path()
if path == "/api/v1/health" || path == "/api/v1/ready" {

View File

@ -72,6 +72,8 @@ spec:
value: "{{ .WORMSCAN_RATELIMIT_ENABLED }}"
- name: WORMSCAN_RATELIMIT_MAX
value: "{{ .WORMSCAN_RATELIMIT_MAX }}"
- name: WORMSCAN_RATELIMIT_TOKENS
value: "{{ .WORMSCAN_RATELIMIT_TOKENS }}"
- name: WORMSCAN_RATELIMIT_PREFIX
valueFrom:
configMapKeyRef: