Skip to content

Commit

Permalink
changes to add project information with cluster lookup (#79)
Browse files Browse the repository at this point in the history
feat: changes to add project information with cluster lookup
---------

Signed-off-by: niravparikh05 <nir.parikh05@gmail.com>
  • Loading branch information
niravparikh05 committed Sep 21, 2023
1 parent e55c6e9 commit e037e71
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 353 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17 as build
FROM golang:1.20 as build
LABEL description="Build container"

WORKDIR /build
Expand Down
8 changes: 8 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
#FROM gcr.io/distroless/static:latest
## use base:debug for shell access
FROM gcr.io/distroless/static:latest
WORKDIR /
COPY relay.upx relay
ENTRYPOINT ["/relay"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
IMG ?= relay:latest
TS := $(shell /bin/date "+%Y%m%d%H%M%S")
DEV_USER ?= dev
DEV_USER ?= paralusio
DEV_TAG := docker.io/${DEV_USER}/relay:$(TS)

.PHONY: tidy
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/paralus/relay

go 1.17
go 1.20

require (
github.com/cenkalti/backoff v2.2.1+incompatible
Expand All @@ -12,7 +12,7 @@ require (
github.com/inconshreveable/go-vhost v0.0.0-20160627193104-06d84117953b
github.com/jinzhu/inflection v1.0.0
github.com/julienschmidt/httprouter v1.3.0
github.com/paralus/paralus v0.2.2
github.com/paralus/paralus v0.2.5-0.20230921060456-1b7a9a1fa32e
github.com/rs/xid v1.3.0
github.com/segmentio/encoding v0.3.4
github.com/spf13/pflag v1.0.5
Expand Down
350 changes: 2 additions & 348 deletions go.sum

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion pkg/tail/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ func (t *transformer) getParams(url string) httprouter.Params {

func (t *transformer) Transform(lm *LogMsg, am *AuditMsg) error {

//_log.Infow("transforming", "logMessage", *lm)
cluster, err := t.getCluster(lm.ServerName)
if err != nil {
_log.Infow("unable to lookup cluster", "error", err)
Expand All @@ -184,9 +183,12 @@ func (t *transformer) Transform(lm *LogMsg, am *AuditMsg) error {
return err
}

_log.Debug("cluster info for logging", "cluster", cluster)

params := t.getParams(lm.URL)

am.ClusterName = cluster.Name
am.ProjectName = cluster.Project
am.OrganizationID = user.OrganizationID
am.PartnerID = user.PartnerID
am.UserName = user.UserName
Expand Down
1 change: 1 addition & 0 deletions pkg/tail/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type AuditMsg struct {
UserName string `json:"un"`
OrganizationID string `json:"o"`
PartnerID string `json:"p"`
ProjectName string `json:"pr"`
RemoteAddr string `json:"ra"`
Duration float64 `json:"d"`
ClusterName string `json:"cn"`
Expand Down

0 comments on commit e037e71

Please sign in to comment.