Skip to content

Commit 4ec8460

Browse files
committed
feat(axosyslog): add loki tenant id support
Signed-off-by: Vadim Aleksandrov <[email protected]>
1 parent 3ab40da commit 4ec8460

File tree

9 files changed

+43
-0
lines changed

9 files changed

+43
-0
lines changed

charts/logging-operator/charts/logging-operator-crds/templates/logging.banzaicloud.io_syslogngclusteroutputs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,8 @@ spec:
14681468
type: integer
14691469
template:
14701470
type: string
1471+
tenant-id:
1472+
type: string
14711473
time_reopen:
14721474
type: integer
14731475
timestamp:

charts/logging-operator/charts/logging-operator-crds/templates/logging.banzaicloud.io_syslogngoutputs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,8 @@ spec:
14681468
type: integer
14691469
template:
14701470
type: string
1471+
tenant-id:
1472+
type: string
14711473
time_reopen:
14721474
type: integer
14731475
timestamp:

charts/logging-operator/crds/logging.banzaicloud.io_syslogngclusteroutputs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,8 @@ spec:
14651465
type: integer
14661466
template:
14671467
type: string
1468+
tenant-id:
1469+
type: string
14681470
time_reopen:
14691471
type: integer
14701472
timestamp:

charts/logging-operator/crds/logging.banzaicloud.io_syslogngoutputs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,8 @@ spec:
14651465
type: integer
14661466
template:
14671467
type: string
1468+
tenant-id:
1469+
type: string
14681470
time_reopen:
14691471
type: integer
14701472
timestamp:

config/crd/bases/logging.banzaicloud.io_syslogngclusteroutputs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,8 @@ spec:
14651465
type: integer
14661466
template:
14671467
type: string
1468+
tenant-id:
1469+
type: string
14681470
time_reopen:
14691471
type: integer
14701472
timestamp:

config/crd/bases/logging.banzaicloud.io_syslogngoutputs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,8 @@ spec:
14651465
type: integer
14661466
template:
14671467
type: string
1468+
tenant-id:
1469+
type: string
14681470
time_reopen:
14691471
type: integer
14701472
timestamp:

docs/configuration/plugins/syslogng-outputs/loki.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ The number of times syslog-ng OSE attempts to send a message to this destination
8686
Template for customizing the log message format.
8787

8888

89+
### tenant-id (string, optional) {#lokioutput-tenant-id}
90+
91+
Sets the tenant ID for multi-tenant scenarios. See [syslog-ng docs](https://axoflow.com/docs/axosyslog-core/chapter-destinations/configuring-destinations-http-nonjava/reference-destination-http-nonjava/#persist-name) for more information.
92+
93+
8994
### time_reopen (int, optional) {#lokioutput-time_reopen}
9095

9196
The time to wait in seconds before a dead connection is reestablished.

pkg/sdk/logging/model/syslogng/config/output_tests/loki_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,29 @@ func TestLokiOutputTable(t *testing.T) {
189189
config: `destination "output_default_test-loki-buffer-out" {
190190
loki(url("test.local") disk_buffer(disk_buf_size(1000) reliable(yes) compaction(yes) dir("/buffers") mem_buf_length(1000) mem_buf_size(1000) qout_size(1000)) batch-lines(2000) batch-timeout(10) workers(3) persist_name("output_default_test-loki-buffer-out") log-fifo-size(1000));
191191
};
192+
`,
193+
},
194+
{
195+
name: "test_tenant",
196+
output: v1beta1.SyslogNGOutput{
197+
ObjectMeta: metav1.ObjectMeta{
198+
Namespace: "default",
199+
Name: "test-loki-out",
200+
},
201+
Spec: v1beta1.SyslogNGOutputSpec{
202+
Loki: &output.LokiOutput{
203+
URL: "test.local",
204+
BatchLines: 2000,
205+
BatchTimeout: 10,
206+
Workers: 3,
207+
LogFIFOSize: 1000,
208+
TenantID: "test-tenant",
209+
},
210+
},
211+
},
212+
config: `destination "output_default_test-loki-out" {
213+
loki(url("test.local") batch-lines(2000) batch-timeout(10) workers(3) persist_name("output_default_test-loki-out") log-fifo-size(1000) tenant-id("test-tenant"));
214+
};
192215
`,
193216
},
194217
}

pkg/sdk/logging/model/syslogng/output/loki.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,7 @@ type LokiOutput struct {
9393
Timestamp string `json:"timestamp,omitempty"`
9494
// Template for customizing the log message format.
9595
Template string `json:"template,omitempty"`
96+
// Sets the tenant ID for multi-tenant scenarios.
97+
// See [syslog-ng docs](https://axoflow.com/docs/axosyslog-core/chapter-destinations/configuring-destinations-http-nonjava/reference-destination-http-nonjava/#persist-name) for more information.
98+
TenantID string `json:"tenant-id,omitempty"`
9699
}

0 commit comments

Comments
 (0)