# Logstash- Create different logfiles for different pipeline

**URL:** <https://discuss.elastic.co/t/logstash-create-different-logfiles-for-different-pipeline/286370>\
**Category:** Logstash\
**Created:** [October 11, 2021, 1:06pm UTC](https://discuss.elastic.co/t/logstash-create-different-logfiles-for-different-pipeline/286370 "2021-10-11T13:06:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![praffuln](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praffuln/32/49232_2.png) [@praffuln](https://discuss.elastic.co/u/praffuln)\
**Post date:** [October 11, 2021, 1:06pm UTC](https://discuss.elastic.co/t/logstash-create-different-logfiles-for-different-pipeline/286370/1 "2021-10-11T13:06:11Z")

</div>

Hi,

I am using logstash log4j2.properties configuration for log controlling e.g. log rotation, log preservation, controlling file name for logging, location of logs etc.

Based on below discussion I used to configure log4j2.properties.

> [@Logstash log4j2.properties configuration for pipeline logs](https://discuss.elastic.co/t/logstash-log4j2-properties-configuration-for-pipeline-logs/278612):
>
> In our application, logstash.yml is configured to produce separate log files for each pipeline with the help of below property pipeline.separate\_logs: true This configuration setup is creating the below mentioned logs: logstash-plain.log pipeline\_\<pipeline\_id\>.log logstash\_plain.log is getting converted to a zip file logstash-plain-\<date\>.log.gz each day but piepline\_\<pipeline\_id\>.log is observed to be getting appended to the same file for every logstash run. Pipeline log turned out to be oc…

I have 3 pipelines running on my log stash environment.  
PipelineA.config, PipelineB.config, PipelineC.config but due to log4j2.properties configuration it is writing only in one log file logfilename.logs

I want 3 different log files for different pipelines, and create 3 separate log files for easy debugging.  
PipelineA.config should write in PipelineA.log file.  
PipelineB.config should write in PipelineB.log file.  
PipelineC.config should write in PipelineC.log file.

How is this possible by log4j2.config ?

Thanks in Advance.

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [October 11, 2021, 5:14pm UTC](https://discuss.elastic.co/t/logstash-create-different-logfiles-for-different-pipeline/286370/2 "2021-10-11T17:14:52Z")

</div>

Hi @praffuln

Are you using this setting in logstash.yml ?

> pipeline.separate\_logs: true

```auto
# ------------ Other Settings --------------
#
# Where to find custom plugins
# path.plugins: []
#
# Flag to output log lines of each pipeline in its separate log file. Each log filename contains the pipeline.name
# Default is false
pipeline.separate_logs: true

```

---

<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:** [November 8, 2021, 5:15pm UTC](https://discuss.elastic.co/t/logstash-create-different-logfiles-for-different-pipeline/286370/3 "2021-11-08T17:15:30Z")

</div>

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