Translate plugin using csv

Hello,

I'm trying to parse all the columns of a CSV file (except the first one, obviously).
The plugin only get the second column as result of the filter.
All the other column are ignored.

It should be possible, according to this sentence getting from the documentation :

When using a CSV dictionary, multiple values in the translation must be extracted with another filter e.g. Dissect or KV. Note that the fallback is a string so on no match the fallback setting needs to formatted so that a filter can extract the multiple values to the correct fields.

Here is my logstash code :

translate {
    field => "idBatch"
    dictionary_path => "D:\idBatch-description.csv"
	refresh_interval => 500
    destination => "donneesDictionnaireExterne"
	# Données par défaut en l'absence de correspondance
    fallback => "Aucune correspondance trouvée,10000"
	add_tag => [ "import_CSV_ok"]
}

# Mapper des données du dictionnaire externe
dissect {
    mapping => {
        "donneesDictionnaireExterne" => "%{descriptionBatch},%{maxDuration}"
        # EXEMPLE pour GAR01B0 : Batch d'injection Archive;86408
    }
}

Here is a sample of my CSV file :

"GDA08A0_SupPdc","Batch de Suppression de PDC","9999"
"GDI01A0_Parsing","Moteur de parsing des etats internes","9999"

Does anyone know why it doesn't work ?

Edit : this is how it's supposed to be

"GDA08A0_SupPdc","Batch de Suppression de PDC"|"9999"
"GDI01A0_Parsing","Moteur de parsing des etats internes"|"9999"

or

"GDA08A0_SupPdc","Batch de Suppression de PDC";"9999"
"GDI01A0_Parsing","Moteur de parsing des etats internes";"9999"

This is working as designed. The translate filter accepts a 2 column CSV. That sentence is trying to tell you that if you want multiple fields, you have to parse them out of the second column, which cannot be comma separated.

For example, you could use

key,field1|field2|field3

and then use a csv filter to split the second column.

1 Like

Thank you Badger.
That's exactely what I've done afterwards.

I've edit my post to give the answer.
I'm glad you did answer me so I can add the solution :slight_smile:

But what I want to do is using Excel to edit the *.csv.
Do you have any clue ?

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