graylog2-server icon indicating copy to clipboard operation
graylog2-server copied to clipboard

Allow multiple configurations for a sidecar

Open bitfactory-henno-schooljan opened this issue 7 years ago • 13 comments

In Graylog 2, tags were a very convenient method for classifying and combining configurations for specific sidecars. E.g. a generic 'linux' tag for gathering generic logs from all Linux machines, and more specific tags that would only apply to certain machines (including these Linux machines). Simply defining the appropriate tags in a sidecar configuration file on a server would cause it to collect the correct logs from this server, using the combined configurations for all these tags.

With the removal of tag-based configuration it looks like it is no longer possible to apply multiple configurations to a sidecar. I need to create a configuration for every single combination of (former) tags I want to use on all my servers, and combine the desired log inputs inside all these configurations using variables if I want to avoid duplication. The number of combinations can grow exponentially when more log inputs are introduced.

How difficult would it be to allow multiple configurations to be applied to a sidecar, effectively allowing the combination of different configurations without having to create a lot of compound configurations every time a new log input is introduced?

Please refer to this community thread for a workaround: https://community.graylog.org/t/graylog-3-0-filebeat-configuration-and-tags/8949/16

deeshe avatar Feb 25 '19 15:02 deeshe

One possible way to support this, is that we add a tags list back into the sidecar.yml. We could expose these tags as runtime variables. So let's say that your sidecar.yml has tags: [ "apache", "rails" ]

your configuration could render sections based on tags. For instance

filebeat.inputs:
 - type: log
   paths:
    - /var/log/test*.log
    <#if sidecar.tags.apache?? >
    - /var/log/apache
    </#if>
    <#if sidecar.tags.rails?? >
    - /var/log/rails/application.log
    </#if>

mpfz0r avatar Mar 07 '19 15:03 mpfz0r

Hello, Unfortunately, this doesn't work for Graylog 3.2 and a new sidecar.

menai34 avatar Mar 20 '20 09:03 menai34

Yeah, it would be nice to have this in the future but please focus on supporting ES 7

zez3 avatar Mar 20 '20 13:03 zez3

The help for the most recent Graylog version implies, that the conditional configuration of sidecars should work:

image

I tried this but never succeeded. Seems that the if statement is somehow processed, but the tags in sidcar.yaml do not "reach" graylog when the configuration is rendered. Is this a documentation issue or a bug? Reading this issue I would say it's not correctly documented.

As this feature makes a lot of sense a +1 for me to re-implement it.

mpibpc-mroose avatar Jan 13 '23 12:01 mpibpc-mroose

@mpibpc-mroose which version of graylog and sidecar are you using?

mpfz0r avatar Jan 13 '23 13:01 mpfz0r

both in the newest versions:

Graylog: 5.0.2 Sidecar: 1.2.0

Discussed that in the graylog forum, too:

https://community.graylog.org/t/use-sidecar-tags-in-filebeat-config/27251

mpibpc-mroose avatar Jan 13 '23 13:01 mpibpc-mroose

You need at least sidecar 1.3.0 for this. As of today we also released 1.4.0

mpfz0r avatar Jan 13 '23 13:01 mpfz0r

Hi everyone, I think we can close this now.

With Graylog 5.0 (and Sidecar 1.3) we released the possibility to automatically assign Sidecar configurations, based on tags.

A list of tags can be assigned in a Sidecar's YAML configuration. Collector configuration matching any of these tags will then automatically be applied to the Sidecar.

Details:

  • https://github.com/Graylog2/graylog2-server/pull/13433
  • https://go2docs.graylog.org/5-0/getting_in_log_data/graylog_sidecar.html?Highlight=sidecar#AssigningTags

Recently a related change was added to the Sidecar installer on Windows to accept tags at installation time, for convenience:

  • https://github.com/Graylog2/collector-sidecar/pull/464

boosty avatar Jan 13 '23 13:01 boosty

Great but the doc is not clear about this. I copy/paste the doc with "1.2" written in the commands. perhaps you should edit and replace "1.2" with "$version" or something like that.

The doc about tags and sniplets is minimalist too.

BenoitPoulet avatar Jan 13 '23 13:01 BenoitPoulet

@BenoitPoulet which docs are you referring to specifically?

mpfz0r avatar Jan 13 '23 13:01 mpfz0r

This doc : https://go2docs.graylog.org/5-0/getting_in_log_data/graylog_sidecar.html

BenoitPoulet avatar Jan 13 '23 16:01 BenoitPoulet

@BenoitPoulet ah, thanks. I'll get that fixed. It should be wget https://packages.graylog2.org/repo/packages/graylog-sidecar-repository_1-5_all.deb and sudo rpm -Uvh https://packages.graylog2.org/repo/packages/graylog-sidecar-repository-1-5.noarch.rpm

mpfz0r avatar Jan 13 '23 17:01 mpfz0r