Skip to content

Commit

Permalink
Add "tags" field to configuration and registration request (#443)
Browse files Browse the repository at this point in the history
* Add "tags" field to configuration and registration request

* Add tags to example config file
  • Loading branch information
thll authored Sep 8, 2022
1 parent 8e06df9 commit b1f2f9b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/graylog.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func UpdateRegistration(httpClient *http.Client, checksum string, ctx *context.C

registration.NodeName = ctx.UserConfig.NodeName
registration.NodeDetails.OperatingSystem = common.GetSystemName()
registration.NodeDetails.Tags = ctx.UserConfig.Tags

if ctx.UserConfig.SendStatus {
metrics := &graylog.MetricsRequest{
Disks75: common.GetFileSystemList75(),
Expand Down
1 change: 1 addition & 0 deletions api/graylog/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type NodeDetailsRequest struct {
LogFileList []common.File `json:"log_file_list,omitempty"`
Metrics *MetricsRequest `json:"metrics,omitempty"`
Status *StatusRequest `json:"status,omitempty"`
Tags []string `json:"tags,omitempty"`
}

type StatusRequestBackend struct {
Expand Down
2 changes: 2 additions & 0 deletions cfgfile/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type SidecarConfig struct {
ListLogFiles []string `config:"list_log_files"`
CollectorBinariesWhitelist []string `config:"collector_binaries_whitelist"`
CollectorBinariesAccesslist []string `config:"collector_binaries_accesslist"`
Tags []string `config:"tags"`
}

// Default Sidecar configuration
Expand Down Expand Up @@ -68,6 +69,7 @@ collector_binaries_accesslist:
- "/usr/share/journalbeat/bin/journalbeat"
- "/usr/bin/nxlog"
- "/opt/nxlog/bin/nxlog"
tags: []
`

// Windows specific options. Gets merged over `CommonDefaults`
Expand Down
7 changes: 7 additions & 0 deletions sidecar-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ server_api_token: ""
# Directory where the sidecar generates configurations for collectors.
#collector_configuration_directory: "/var/lib/graylog-sidecar/generated"

# A list of tags to assign to this sidecar. Collector configuration matching any of these tags will automatically be
# applied to the sidecar.
# Example:
# tags:
# - apache-logs
# - dns-logs

# A list of binaries which are allowed to be executed by the Sidecar. An empty list disables the access list feature.
# Wildcards can be used, for a full pattern description see https://golang.org/pkg/path/filepath/#Match
# Example:
Expand Down

0 comments on commit b1f2f9b

Please sign in to comment.