Skip to content

Commit b1f2f9b

Browse files
authored
Add "tags" field to configuration and registration request (#443)
* Add "tags" field to configuration and registration request * Add tags to example config file
1 parent 8e06df9 commit b1f2f9b

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

api/graylog.go

+2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ func UpdateRegistration(httpClient *http.Client, checksum string, ctx *context.C
145145

146146
registration.NodeName = ctx.UserConfig.NodeName
147147
registration.NodeDetails.OperatingSystem = common.GetSystemName()
148+
registration.NodeDetails.Tags = ctx.UserConfig.Tags
149+
148150
if ctx.UserConfig.SendStatus {
149151
metrics := &graylog.MetricsRequest{
150152
Disks75: common.GetFileSystemList75(),

api/graylog/requests.go

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type NodeDetailsRequest struct {
3030
LogFileList []common.File `json:"log_file_list,omitempty"`
3131
Metrics *MetricsRequest `json:"metrics,omitempty"`
3232
Status *StatusRequest `json:"status,omitempty"`
33+
Tags []string `json:"tags,omitempty"`
3334
}
3435

3536
type StatusRequestBackend struct {

cfgfile/schema.go

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type SidecarConfig struct {
3636
ListLogFiles []string `config:"list_log_files"`
3737
CollectorBinariesWhitelist []string `config:"collector_binaries_whitelist"`
3838
CollectorBinariesAccesslist []string `config:"collector_binaries_accesslist"`
39+
Tags []string `config:"tags"`
3940
}
4041

4142
// Default Sidecar configuration
@@ -68,6 +69,7 @@ collector_binaries_accesslist:
6869
- "/usr/share/journalbeat/bin/journalbeat"
6970
- "/usr/bin/nxlog"
7071
- "/opt/nxlog/bin/nxlog"
72+
tags: []
7173
`
7274

7375
// Windows specific options. Gets merged over `CommonDefaults`

sidecar-example.yml

+7
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ server_api_token: ""
6262
# Directory where the sidecar generates configurations for collectors.
6363
#collector_configuration_directory: "/var/lib/graylog-sidecar/generated"
6464

65+
# A list of tags to assign to this sidecar. Collector configuration matching any of these tags will automatically be
66+
# applied to the sidecar.
67+
# Example:
68+
# tags:
69+
# - apache-logs
70+
# - dns-logs
71+
6572
# A list of binaries which are allowed to be executed by the Sidecar. An empty list disables the access list feature.
6673
# Wildcards can be used, for a full pattern description see https://golang.org/pkg/path/filepath/#Match
6774
# Example:

0 commit comments

Comments
 (0)