Include conf files


(Saram Ali) #1

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

filter {
.... # do stuff B
}

Can this be achieved somehow?

run.conf :

input { ... }

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

output { ... }


(Magnus Bäck) #2

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


(Saram Ali) #3

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.


(Magnus Bäck) #4

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


(Saram Ali) #5

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


(Magnus Bäck) #6

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


(Saram Ali) #7

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.


(Magnus Bäck) #8

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.


(Saram Ali) #9

Can you provide an example of this, Thank you.


(Magnus Bäck) #10

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.


(system) #11

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