Include conf files

filter {
.... # do stuff A
}
B.conf :

filter {
.... # do stuff B
}

Can this be achieved somehow?

run.conf :

input { ... }

include('B')
include('C')

output { ... }

1 Like

No, Logstash has no inclusion functionality. If you explain the situation in greater detail we might be able to give another suggestion.

I'll try. Currently I have one configuration file which deals with multiple clients.

I want to separate the script, so now each client will have it's own script. But you see there are few functionalities which are common between the clients. Considering the filter part will exactly be the same for those functionalities there must be an approach for reuse-ability. So I can include the part which is the same in the scripts rather than writing the same script again and again; copy pasta.

Considering the client will grow I need to have an approach in which I re use my already written script.

And you have separate instances or pipelines for different clients? Use symlinks to have the same file appear in multiple directories.

Yes, separate instances for each client. Is there any other alternative?

Other alternatives to having one instance per client? You can have a single instance with multiple pipelines.

Well I was taking about reusing the similar part of conf file which is common across the clients by using include or some other approach.

As I said there is no inclusion functionality. The only other option I can think of is generating compound configuration files based on multiple source files.

Can you provide an example of this, Thank you.

You store the configuration files in whatever form you want, then use a script to concatenate the files according to some set of rules. That way you can feed Logstash a single configuration file (or multiple, that's up to how the script is written) while still maintaining the pieces separately and without duplication.

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