Answers: <p>"I have two Filebeat pipes inputting into Logstash."
  ---I assume this means that you have conditional logic and/or prospectors in your filebeat config to ship to the multiple logstash (5044 and 5043)ports?  I'd be interested to see that config.</p>
  
  <p>Here's another approach that might acheive your goal:  Use the source value in a conditional output. An example of logstash conditional outputs can be found here: <a href="https://discuss.elastic.co/t/conditional-statement-in-output/74672" rel="nofollow noreferrer">https://discuss.elastic.co/t/conditional-statement-in-output/74672</a></p>
  
  <p>If, for some reason filebeat's 'source' field will not suffice: you might inject your own fields, per prospector, as described by andrewkroh midway through the thread here: <a href="https://discuss.elastic.co/t/how-to-tag-log-files-in-filebeat-for-logstash-ingestion/44713/6" rel="nofollow noreferrer">https://discuss.elastic.co/t/how-to-tag-log-files-in-filebeat-for-logstash-ingestion/44713/6</a>.  Then you could do conditional output on your custom fields.  The example Andrew provided for adding custom fields by prospector is as follows:</p>
  
  <pre><code>```filebeat:
  ```  prospectors:
  ```    - paths:
  ```        - /path/to/logs/access.log
  ```      fields:  {log_type: access}
  ```    - paths:
  ```        - /path/to/other/logs/errors.log
  ```      fields: {log_type: errors}
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2019-06-25T18:49:50.783Z
Answers: 2019-06-25T18:55:17.987Z
Answers: 2019-06-25T18:55:17.987Z
Answers: satsujinsha
Body: <p>I have two Filebeat pipes inputting into Logstash. One parses out log errors that I actually care about from one service while the other takes each line in order to keep track of the health of another service that often crashes by just hanging indefinitely. Originally, I was only running the exceptions pipe which was working and filtering correctly.</p>
  
  <p>Yesterday, I added the second pipe. I used the pipelines.yml file. The Logstash log shows that both pipelines are initialized correctly at startup, shows that there are two pipelines running. They are running the inputs on separate ports as required. Filebeat side is also configured to run on the correct ports.</p>
  
  <p>The problem is that they are outputting to the same index and now the filtering for the exception logs is being ignored. It's like the exception log config file is being completely disregarded except for the part about which port to receive from Filebeat on.</p>
  
  <p>Has anyone had this issue, or should this be a bug report to the ES team? Below are my config file input/outputs and pipelines.yml setup, just in case anyone can glance and see that I'm missing something. It's completely perplexing me because it's an extremely simple setup.</p>
  
  <p>Config1:</p>
  
  <pre><code>input {
      beats {
          port =&gt; "5044"
  
      }
  }
  ...
  output {
      elasticsearch {
          hosts =&gt; ["http://****:9200"]
          index =&gt; "logtailing-%{[@metadata][version]}-%{+YYYY.MM.dd}" 
      }
  }
  </code></pre>
  
  <p>Config2:</p>
  
  <pre><code>input {
      beats {
          port =&gt; "5043"
  
      }
  }
  ...
  output {
      elasticsearch {
          hosts =&gt; ["http://****:9200"]
          index =&gt; "releaserexceptions-%{[@metadata][version]}-%{+YYYY.MM.dd}" 
      }
  }
  </code></pre>
  
  <p>pipelines.yml:</p>
  
  <pre><code> - pipeline.id: logtailing
     path.config: "../config/logtailing.conf"
   - pipeline.id: releaserexceptions
     path.config: "../config/releaserexceptions.conf"
  </code></pre>
  
  <p>Logstash logs look like this so it seems to me it should be working with no issues:</p>
  
  <pre><code>[2019-01-04T12:46:26,256][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=&gt;"6.4.0"}
  [2019-01-04T12:46:31,249][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=&gt;"logtailing", "pipeline.workers"=&gt;1, "pipeline.batch.size"=&gt;125, "pipeline.batch.delay"=&gt;50}
  [2019-01-04T12:46:32,138][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=&gt;{:removed=&gt;[], :added=&gt;[http://****:9200/]}}
  [2019-01-04T12:46:32,151][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=&gt;http://****:9200/, :path=&gt;"/"}
  [2019-01-04T12:46:32,644][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=&gt;"releaserexceptions", "pipeline.workers"=&gt;1, "pipeline.batch.size"=&gt;125, "pipeline.batch.delay"=&gt;50}
  [2019-01-04T12:46:32,670][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=&gt;{:removed=&gt;[], :added=&gt;[http://****:9200/]}}
  [2019-01-04T12:46:32,672][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=&gt;http://****:9200/, :path=&gt;"/"}
  [2019-01-04T12:46:32,741][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=&gt;"http://****:9200/"}
  [2019-01-04T12:46:32,806][INFO ][logstash.outputs.elasticsearch] ES Output version determined {:es_version=&gt;6}
  [2019-01-04T12:46:32,811][WARN ][logstash.outputs.elasticsearch] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document _type {:es_version=&gt;6}
  [2019-01-04T12:46:32,842][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=&gt;"LogStash::Outputs::ElasticSearch", :hosts=&gt;["http://****:9200"]}
  [2019-01-04T12:46:32,869][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=&gt;nil}
  [2019-01-04T12:46:32,900][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=&gt;{"template"=&gt;"logstash-*", "version"=&gt;60001, "settings"=&gt;{"index.refresh_interval"=&gt;"5s"}, "mappings"=&gt;{"_default_"=&gt;{"dynamic_templates"=&gt;[{"message_field"=&gt;{"path_match"=&gt;"message", "match_mapping_type"=&gt;"string", "mapping"=&gt;{"type"=&gt;"text", "norms"=&gt;false}}}, {"string_fields"=&gt;{"match"=&gt;"*", "match_mapping_type"=&gt;"string", "mapping"=&gt;{"type"=&gt;"text", "norms"=&gt;false, "fields"=&gt;{"keyword"=&gt;{"type"=&gt;"keyword", "ignore_above"=&gt;256}}}}}], "properties"=&gt;{"@timestamp"=&gt;{"type"=&gt;"date"}, "@version"=&gt;{"type"=&gt;"keyword"}, "geoip"=&gt;{"dynamic"=&gt;true, "properties"=&gt;{"ip"=&gt;{"type"=&gt;"ip"}, "location"=&gt;{"type"=&gt;"geo_point"}, "latitude"=&gt;{"type"=&gt;"half_float"}, "longitude"=&gt;{"type"=&gt;"half_float"}}}}}}}}
  [2019-01-04T12:46:33,461][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=&gt;"http://****:9200/"}
  [2019-01-04T12:46:33,466][INFO ][logstash.outputs.elasticsearch] ES Output version determined {:es_version=&gt;6}
  [2019-01-04T12:46:33,466][WARN ][logstash.outputs.elasticsearch] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document _type {:es_version=&gt;6}
  [2019-01-04T12:46:33,468][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=&gt;"LogStash::Outputs::ElasticSearch", :hosts=&gt;["http://****:9200"]}
  [2019-01-04T12:46:33,474][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=&gt;nil}
  [2019-01-04T12:46:33,499][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=&gt;{"template"=&gt;"logstash-*", "version"=&gt;60001, "settings"=&gt;{"index.refresh_interval"=&gt;"5s"}, "mappings"=&gt;{"_default_"=&gt;{"dynamic_templates"=&gt;[{"message_field"=&gt;{"path_match"=&gt;"message", "match_mapping_type"=&gt;"string", "mapping"=&gt;{"type"=&gt;"text", "norms"=&gt;false}}}, {"string_fields"=&gt;{"match"=&gt;"*", "match_mapping_type"=&gt;"string", "mapping"=&gt;{"type"=&gt;"text", "norms"=&gt;false, "fields"=&gt;{"keyword"=&gt;{"type"=&gt;"keyword", "ignore_above"=&gt;256}}}}}], "properties"=&gt;{"@timestamp"=&gt;{"type"=&gt;"date"}, "@version"=&gt;{"type"=&gt;"keyword"}, "geoip"=&gt;{"dynamic"=&gt;true, "properties"=&gt;{"ip"=&gt;{"type"=&gt;"ip"}, "location"=&gt;{"type"=&gt;"geo_point"}, "latitude"=&gt;{"type"=&gt;"half_float"}, "longitude"=&gt;{"type"=&gt;"half_float"}}}}}}}}
  [2019-01-04T12:46:33,813][INFO ][logstash.inputs.beats    ] Beats inputs: Starting input listener {:address=&gt;"0.0.0.0:5043"}
  [2019-01-04T12:46:33,831][INFO ][logstash.inputs.beats    ] Beats inputs: Starting input listener {:address=&gt;"0.0.0.0:5044"}
  [2019-01-04T12:46:33,903][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=&gt;"logtailing", :thread=&gt;"#&lt;Thread:0x132b2cfb run&gt;"}
  [2019-01-04T12:46:33,903][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=&gt;"releaserexceptions", :thread=&gt;"#&lt;Thread:0xaf8b522 run&gt;"}
  [2019-01-04T12:46:33,998][INFO ][logstash.agent           ] Pipelines running {:count=&gt;2, :running_pipelines=&gt;[:logtailing, :releaserexceptions], :non_running_pipelines=&gt;[]}
  [2019-01-04T12:46:34,013][INFO ][org.logstash.beats.Server] Starting server on port: 5043
  [2019-01-04T12:46:34,013][INFO ][org.logstash.beats.Server] Starting server on port: 5044
  [2019-01-04T12:46:34,453][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=&gt;9600}
  </code></pre>
  
Tags: <logstash>
Title: Multiple Logstash Pipelines outputting into same index
UserDisplayName: Jack Winkler
ThreadText: # Multiple Logstash Pipelines outputting into same index
  
  (Asked by: username_0 on 2019-01-04)
  
  I have two Filebeat pipes inputting into Logstash. One parses out log errors that I actually care about from one service while the other takes each line in order to keep track of the health of another service that often crashes by just hanging indefinitely. Originally, I was only running the exceptions pipe which was working and filtering correctly.
  
  Yesterday, I added the second pipe. I used the pipelines.yml file. The Logstash log shows that both pipelines are initialized correctly at startup, shows that there are two pipelines running. They are running the inputs on separate ports as required. Filebeat side is also configured to run on the correct ports.
  
  The problem is that they are outputting to the same index and now the filtering for the exception logs is being ignored. It's like the exception log config file is being completely disregarded except for the part about which port to receive from Filebeat on.
  
  Has anyone had this issue, or should this be a bug report to the ES team? Below are my config file input/outputs and pipelines.yml setup, just in case anyone can glance and see that I'm missing something. It's completely perplexing me because it's an extremely simple setup.
  
  Config1:
  
  ```
  input {
      beats {
          port => "5044"
  
      }
  }
  ...
  output {
      elasticsearch {
          hosts => ["http://****:9200"]
          index => "logtailing-%{[@metadata][version]}-%{+YYYY.MM.dd}" 
      }
  }
  
  ```
  
  Config2:
  
  ```
  input {
      beats {
          port => "5043"
  
      }
  }
  ...
  output {
      elasticsearch {
          hosts => ["http://****:9200"]
          index => "releaserexceptions-%{[@metadata][version]}-%{+YYYY.MM.dd}" 
      }
  }
  
  ```
  
  pipelines.yml:
  
  ```
   - pipeline.id: logtailing
     path.config: "../config/logtailing.conf"
   - pipeline.id: releaserexceptions
     path.config: "../config/releaserexceptions.conf"
  
  ```
  
  Logstash logs look like this so it seems to me it should be working with no issues:
  
  ```
  [2019-01-04T12:46:26,256][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.4.0"}
  [2019-01-04T12:46:31,249][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"logtailing", "pipeline.workers"=>1, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
  [2019-01-04T12:46:32,138][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://****:9200/]}}
  [2019-01-04T12:46:32,151][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://****:9200/, :path=>"/"}
  [2019-01-04T12:46:32,644][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"releaserexceptions", "pipeline.workers"=>1, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
  [2019-01-04T12:46:32,670][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://****:9200/]}}
  [2019-01-04T12:46:32,672][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://****:9200/, :path=>"/"}
  [2019-01-04T12:46:32,741][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>"http://****:9200/"}
  [2019-01-04T12:46:32,806][INFO ][logstash.outputs.elasticsearch] ES Output version determined {:es_version=>6}
  [2019-01-04T12:46:32,811][WARN ][logstash.outputs.elasticsearch] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document _type {:es_version=>6}
  [2019-01-04T12:46:32,842][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["http://****:9200"]}
  [2019-01-04T12:46:32,869][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>nil}
  [2019-01-04T12:46:32,900][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=>{"template"=>"logstash-*", "version"=>60001, "settings"=>{"index.refresh_interval"=>"5s"}, "mappings"=>{"_default_"=>{"dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date"}, "@version"=>{"type"=>"keyword"}, "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"type"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"half_float"}}}}}}}}
  [2019-01-04T12:46:33,461][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>"http://****:9200/"}
  [2019-01-04T12:46:33,466][INFO ][logstash.outputs.elasticsearch] ES Output version determined {:es_version=>6}
  [2019-01-04T12:46:33,466][WARN ][logstash.outputs.elasticsearch] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document _type {:es_version=>6}
  [2019-01-04T12:46:33,468][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["http://****:9200"]}
  [2019-01-04T12:46:33,474][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>nil}
  [2019-01-04T12:46:33,499][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=>{"template"=>"logstash-*", "version"=>60001, "settings"=>{"index.refresh_interval"=>"5s"}, "mappings"=>{"_default_"=>{"dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date"}, "@version"=>{"type"=>"keyword"}, "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"type"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"half_float"}}}}}}}}
  [2019-01-04T12:46:33,813][INFO ][logstash.inputs.beats    ] Beats inputs: Starting input listener {:address=>"0.0.0.0:5043"}
  [2019-01-04T12:46:33,831][INFO ][logstash.inputs.beats    ] Beats inputs: Starting input listener {:address=>"0.0.0.0:5044"}
  [2019-01-04T12:46:33,903][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=>"logtailing", :thread=>"#<Thread:0x132b2cfb run>"}
  [2019-01-04T12:46:33,903][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=>"releaserexceptions", :thread=>"#<Thread:0xaf8b522 run>"}
  [2019-01-04T12:46:33,998][INFO ][logstash.agent           ] Pipelines running {:count=>2, :running_pipelines=>[:logtailing, :releaserexceptions], :non_running_pipelines=>[]}
  [2019-01-04T12:46:34,013][INFO ][org.logstash.beats.Server] Starting server on port: 5043
  [2019-01-04T12:46:34,013][INFO ][org.logstash.beats.Server] Starting server on port: 5044
  [2019-01-04T12:46:34,453][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
  
  ```
  
  **Tags:** logstash
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-06-25. Score: 1
  
  "I have two Filebeat pipes inputting into Logstash."
  ---I assume this means that you have conditional logic and/or prospectors in your filebeat config to ship to the multiple logstash (5044 and 5043)ports? I'd be interested to see that config.
  
  Here's another approach that might acheive your goal: Use the source value in a conditional output. An example of logstash conditional outputs can be found here: <https://discuss.elastic.co/t/conditional-statement-in-output/74672>
  
  If, for some reason filebeat's 'source' field will not suffice: you might inject your own fields, per prospector, as described by andrewkroh midway through the thread here: <https://discuss.elastic.co/t/how-to-tag-log-files-in-filebeat-for-logstash-ingestion/44713/6>. Then you could do conditional output on your custom fields. The example Andrew provided for adding custom fields by prospector is as follows:
  
  ```
  ```filebeat:
  ```  prospectors:
  ```    - paths:
  ```        - /path/to/logs/access.log
  ```      fields:  {log_type: access}
  ```    - paths:
  ```        - /path/to/other/logs/errors.log
  ```      fields: {log_type: errors}
  
  ```
  
  
  ---
  
  