Skip to content

Commit

Permalink
fix: change indexed fields (#842)
Browse files Browse the repository at this point in the history
Co-authored-by: David Ragot <[email protected]>
  • Loading branch information
Dav-14 and David Ragot authored Nov 10, 2023
1 parent 3e645a1 commit 71c5783
Show file tree
Hide file tree
Showing 23 changed files with 24 additions and 28 deletions.
3 changes: 1 addition & 2 deletions components/gateway/internal/audit/messages/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package messages

import (
"net/http"
"net/url"
"time"

"github.com/formancehq/stack/libs/go-libs/publish"
Expand All @@ -17,7 +16,7 @@ const (

type HttpRequest struct {
Method string `json:"method"`
Url *url.URL `json:"path"`
Path string `json:"path"`
Host string `json:"host"`
Header http.Header `json:"header"`
Body string `json:"body,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion components/gateway/pkg/plugins/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (a *Audit) provisionKafkaPublisher() error {
func (a Audit) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {
request := messages.HttpRequest{
Method: r.Method,
Url: r.URL,
Path: r.URL.Path,
Host: r.Host,
Header: r.Header,
Body: "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: 3UvKysPmdF7bqb4IU8sFGZNFBwGGp6WpargQQpKvvtY=
stack.formance.cloud/volumes-hash: UXfSw4__EAaJBZzasvjSEBQdMgu0fIS1hfvkTevjxEM=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: 3UvKysPmdF7bqb4IU8sFGZNFBwGGp6WpargQQpKvvtY=
stack.formance.cloud/volumes-hash: UXfSw4__EAaJBZzasvjSEBQdMgu0fIS1hfvkTevjxEM=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: FfOv01oEUm1Fv6d_CaNm87DiFt5YY-B9eduuG7mnfRI=
stack.formance.cloud/volumes-hash: 5ZhZ4XOoB_1eN_Wmql9Gy9zB5Zzhk8S4ZAcNpVNBNQE=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: 3UvKysPmdF7bqb4IU8sFGZNFBwGGp6WpargQQpKvvtY=
stack.formance.cloud/volumes-hash: UXfSw4__EAaJBZzasvjSEBQdMgu0fIS1hfvkTevjxEM=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
data:
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"request\": this.payload.request,\n \"response\": this.payload.response,\n \"when\": this.date\n },\n \"kind\": \"AUDIT\",\n \"when\": this.date\n }\n\n\noutput:\n resource: elasticsearch\n"
gateway_audit.yaml: "input:\n event_bus:\n topic: audit\n consumer_group: search-audit\n\npipeline:\n processors:\n - log:\n message: \"receive message: ${! this }\"\n - switch_event_type:\n events:\n - label: AUDIT\n processors:\n - bloblang: |\n meta id = \"AUDIT-%s\".format(this.payload.id)\n meta action = \"index\"\n \n root = {\n \"data\": this.payload,\n \"indexed\": {\n \"path\": this.payload.request.path,\n },\n \"kind\": \"AUDIT\"\n }\n\n\noutput:\n resource: elasticsearch\n"
ledger_ingestion.yaml: |
---
input:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: 3UvKysPmdF7bqb4IU8sFGZNFBwGGp6WpargQQpKvvtY=
stack.formance.cloud/volumes-hash: UXfSw4__EAaJBZzasvjSEBQdMgu0fIS1hfvkTevjxEM=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Loading

1 comment on commit 71c5783

@vercel
Copy link

@vercel vercel bot commented on 71c5783 Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.