Logstash service multiple configs

Hi,

Just getting started with Logstash and am trying to get the service started using multiple config files on CentOS.

My logstash.service configuration is as follows:

[Unit]
Description=logstash

[Service]
Type=simple
User=logstash
Group=logstash

Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.

Prefixing the path with '-' makes it try to load, but if the file doesn't

exist, it continues onward.

EnvironmentFile=-/etc/default/logstash
EnvironmentFile=-/etc/sysconfig/logstash
ExecStart=/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/
Restart=always
WorkingDirectory=/
Nice=19
LimitNOFILE=16384

My logstash user has permission to the /etc/logstash/conf.d directory. If I append the line:

ExecStart=/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/

with the name of a config the service starts with that config.

Is it possible to pass the directory name into the service config and have Logstash parse all the configs or does all configuration need to be in one config. I've not been able to get a clear answer on this Googling.

Thanks

You can pass a directory as a config path indeed. Logstash will concatenate and sort (inputs->filters->outputs) all files found inside.
This means though that only properly formatted config files have to be inside the directory, any other files will make Logstash throw an error.

Thanks but that doesn't fully answer my query. I believe I've configured the service correctly (i.e. the line "ExecStart=/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/" ) but it doesn't pick up the configs in the directory. If I pass the full path directing it to a config it works ok.

Any ideas what I'm doing wrong?

What about: "ExecStart=/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/*.conf"

That's got it! Thank you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.