# Logstash configの同期を取る方法

**URL:** <https://discuss.elastic.co/t/logstash-config/196698>\
**Category:** 日本語による質問・議論はこちら\
**Created:** [August 26, 2019, 4:20am UTC](https://discuss.elastic.co/t/logstash-config/196698 "2019-08-26T04:20:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![harue](https://avatars.discourse-cdn.com/v4/letter/h/82dd89/32.png) [@harue](https://discuss.elastic.co/u/harue)\
**Post date:** [August 26, 2019, 4:20am UTC](https://discuss.elastic.co/t/logstash-config/196698/1 "2019-08-26T04:20:21Z")

</div>

Logstashの定義ファイルの記載について、質問させて頂きます。

`Filebeat→Logstash→Amazon S3,Elasticsearch`

Logstashにて  
inputは同一でoutputを複数に分けかつoutputによりfilerを定義したいです。

下記例のようにMultiple Pipelinesで定義した場合、  
2つのconfigを同期をとる方法があれば教えてください。

同期  
…S3.cfgがエラーの場合、ES.cfgもエラーとする。  
ES.cfgがエラーの場合、S3.cfgもエラーとする。

▼例

```
pipelines.yml
 pipeline.id: S3
  path.config: "…/S3.cfg"

 pipeline.id: ES
  path.config: "…/ES.cfg"

S3.cfg

input {
beats { 
port => "…" 
} 
} 
output {
s3 {
region => "…" 
bucket => "…" 
prefix => "…" 
temporary_directory => "…" 
} 
}

ES.cfg

input {
beats {
port => "…" 
}
}
filter {
grok {
match => […]
}
output {
elasticsearch {
hosts => ["XXX"]
index => ["…"}
}
}

```

追記  
下記例のように1つのconfigにて定義する場合、  
2つのtypeを同期をとる方法があれば教えてください。

同期  
…type =\> S3がエラーの場合、type =\> ESもエラーとする。  
type =\> ESがエラーの場合、type =\> S3もエラーとする。

> input {
> 
> beats {  
> port =\> "…"  
> type =\> S3  
> }
> 
> beats {  
> port =\> "…"  
> type =\> ES  
> }
> 
> filter {  
> if [type] == "ES" {  
> grok {…}  
> }  
> }  
> }  
> output {  
> if [type] == "S3" {  
> region =\> "…"  
> bucket =\> "…"  
> prefix =\> "…"  
> temporary\_directory =\> "…"  
> }  
> if [type] == "ES" {  
> elasticsearch {  
> hosts =\> ["…"]  
> index =\> "…"}  
> }  
> }

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 23, 2019, 4:20am UTC](https://discuss.elastic.co/t/logstash-config/196698/2 "2019-09-23T04:20:24Z")

</div>

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