From 55636090a1df3e4c8906ffb142831bd2bb4ba634 Mon Sep 17 00:00:00 2001 From: Marco Pfatschbacher Date: Tue, 10 Jan 2023 13:25:39 +0100 Subject: [PATCH] Provide -TAGS= support for windows silent installer (#464) * Provide -TAGS= support for windows silent installer Example usage: `graylog_sidecar_installer_1.4.0-1.SNAPSHOT.exe /S -APITOKEN=myapitoken -TAGS=["IIS","exchange"]` Please note that spaces in tags are not supported. Fixes #460 * changelog --- changelog/unreleased/pr-464.toml | 6 ++++++ dist/chocolatey/graylog-sidecar.nuspec | 5 +++++ dist/recipe.nsi | 10 ++++++++++ sidecar-windows-example.yml | 9 +++++++++ 4 files changed, 30 insertions(+) create mode 100644 changelog/unreleased/pr-464.toml diff --git a/changelog/unreleased/pr-464.toml b/changelog/unreleased/pr-464.toml new file mode 100644 index 0000000..25f254c --- /dev/null +++ b/changelog/unreleased/pr-464.toml @@ -0,0 +1,6 @@ +type = "added" +message = "Provide -TAGS= support for windows silent installer" + +issues = ["460"] +pulls = ["464"] + diff --git a/dist/chocolatey/graylog-sidecar.nuspec b/dist/chocolatey/graylog-sidecar.nuspec index db9920e..6affe56 100644 --- a/dist/chocolatey/graylog-sidecar.nuspec +++ b/dist/chocolatey/graylog-sidecar.nuspec @@ -20,6 +20,11 @@ To properly configure the sidecar, you'll need to pass in your **server url** and your **api token**. choco install graylog-sidecar --install-arguments="'-SERVERURL=http://10.0.2.2:9000/api -APITOKEN=yourapitoken'" + + Other optional example parameters are: + + -TAGS=["example","foo"] -NODENAME=mynodename -NODEID=1234 -SENDSTATUS=false -TLSSKIPVERIFY=true -UPDATEINTERVAL=10s + diff --git a/dist/recipe.nsi b/dist/recipe.nsi index 3d96327..88f880a 100644 --- a/dist/recipe.nsi +++ b/dist/recipe.nsi @@ -51,6 +51,8 @@ Var ParamSendStatus Var ParamApiToken Var ParamNodeId + Var ParamTags + Var Tags Var NodeId Var SendStatus Var Dialog @@ -227,6 +229,7 @@ Section "Post" ${GetOptions} $Params " -SEND_STATUS=" $ParamSendStatus ${GetOptions} $Params " -APITOKEN=" $ParamApiToken ${GetOptions} $Params " -NODEID=" $ParamNodeId + ${GetOptions} $Params " -TAGS=" $ParamTags ${If} $ParamServerUrl != "" StrCpy $ServerUrl $ParamServerUrl @@ -249,6 +252,9 @@ Section "Post" ${If} $ParamNodeId != "" StrCpy $NodeId $ParamNodeId ${EndIf} + ${If} $ParamTags != "" + StrCpy $Tags $ParamTags + ${EndIf} ; set defaults ${If} $ServerUrl == "" @@ -267,6 +273,9 @@ Section "Post" ;sidecar.yml needs double escapes ${WordReplace} "file:$INSTDIR\node-id" "\" "\\" "+" $NodeId ${EndIf} + ${If} $Tags == "" + StrCpy $Tags "[]" + ${EndIf} !insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "" $ServerUrl !insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "" $NodeName @@ -275,6 +284,7 @@ Section "Post" !insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "" $SendStatus !insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "" $ApiToken !insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "" $NodeId + !insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "" $Tags ;Install sidecar service ${If} $IsUpgrade == 'false' diff --git a/sidecar-windows-example.yml b/sidecar-windows-example.yml index b051f09..5e9129e 100644 --- a/sidecar-windows-example.yml +++ b/sidecar-windows-example.yml @@ -72,6 +72,15 @@ send_status: # Default: # windows_drive_range: "CDEFGHIJKLMNOPQRSTUVWXYZ" +# A list of tags to assign to this sidecar. Collector configuration matching any of these tags will automatically be +# applied to the sidecar. +# Default: [] +tags: +# 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: