# Use multiple codec in one file input

**URL:** https://discuss.elastic.co/t/use-multiple-codec-in-one-file-input/79722
**Category:** Logstash
**Created:** [March 23, 2017, 9:58am UTC](https://discuss.elastic.co/t/use-multiple-codec-in-one-file-input/79722 "2017-03-23T09:58:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![stef35340](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@stef35340](https://discuss.elastic.co/u/stef35340)
#### Post date: [March 23, 2017, 9:58am UTC](https://discuss.elastic.co/t/use-multiple-codec-in-one-file-input/79722/1 "2017-03-23T09:58:31Z")

</div>

Hello,

Do you know if there is a possibility to use multiple codecs in the same file input?

I need to manage "multiline" and "plain" codecs for the same file.  
Currently, here is my configuration (I have anonymized data):

```
input{
	
	# ASYNCHRONOUS LOGS
	file{
		
		# Ces deux lignes permettent de ré analyser tous les fichiers du répertoire
		start_position => beginning
		#sincedb_path => "/dev/null"
		# #######
		
		# Chemin du ou des fichiers de logs à analyser
		path => ["List of files to analyze"]
		# On exclut les fichiers d'erreurs
		exclude => "*_ERR.*"
		
		# Aggrégation de champs permettant d' identifier plus précisément les documents
		add_field => {"application" => "myapp"
					  "environment" => "test"
		}
		
		# Permet de gérer les retours à ligne vide de certains logs asynchrones
		codec => multiline{
			pattern => "^%{YEAR}[./-]%{MONTHNUM}[./-]%{MONTHDAY} %{TIME}"
			negate => true
			what => previous
		}
		
		# Type de fichier analysé
		type => "async"
	}
}

```

My need is to have the following:

```
		codec => multiline{
			pattern => "^%{YEAR}[./-]%{MONTHNUM}[./-]%{MONTHDAY} %{TIME}"
			negate => true
			what => previous
		}
		codec => plain{
			charset => "UTF-8"
		}

```

If you have any idea of how can i do that...

Thank you for your feedback

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [March 23, 2017, 10:02am UTC](https://discuss.elastic.co/t/use-multiple-codec-in-one-file-input/79722/2 "2017-03-23T10:02:31Z")

</div>

Why do you need the plain codec? Why not specify the [charset](https://www.elastic.co/guide/en/logstash/current/plugins-codecs-multiline.html#plugins-codecs-multiline-charset) in the multiline codec?

---

<div class="post-metadata">

### Author: ![stef35340](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@stef35340](https://discuss.elastic.co/u/stef35340)
#### Post date: [March 23, 2017, 10:10am UTC](https://discuss.elastic.co/t/use-multiple-codec-in-one-file-input/79722/3 "2017-03-23T10:10:09Z")

</div>

OOOhhhhh...  
I've completely missed this attribute of multiline codec...

Thank you very much.

I think I can close this topic.

Again, thanks!

---

<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: [April 20, 2017, 10:10am UTC](https://discuss.elastic.co/t/use-multiple-codec-in-one-file-input/79722/4 "2017-04-20T10:10:51Z")

</div>

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