# Logstash translate doesn't work

**URL:** https://discuss.elastic.co/t/logstash-translate-doesnt-work/258249
**Category:** Logstash
**Created:** [December 10, 2020, 9:52am UTC](https://discuss.elastic.co/t/logstash-translate-doesnt-work/258249 "2020-12-10T09:52:47Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mihai.radulescu](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mihai.radulescu](https://discuss.elastic.co/u/mihai.radulescu)
#### Post date: [December 10, 2020, 9:52am UTC](https://discuss.elastic.co/t/logstash-translate-doesnt-work/258249/1 "2020-12-10T09:52:47Z")

</div>

Hello,

I have the following code:

```auto
input {
  file {
    path => "/home/path/files/*.csv"
    start_position => "beginning"
  }
}

filter {
      csv {
        columns => ["xx1","xx2","xx3","xx4","Response","TimeStamp","Username","xx5"]
     }
        date {
                        match => ["TimeStamp", "yyyyMMddHHmmss"]
                        locale => "en"
                }
        translate {
                dictionary_path => "/home/mihai/prefixes_trimmed.csv"
                field => "xx4"
                destination => "name"
                fallback => "Unknown Name"
        }
    }

output {
  elasticsearch {
  hosts => ["localhost:9200"]
  index => "mihai"
  }
 }

```

The prefix is a substring of first 5 or 6 digits from xx4 field. I expect the variable "name" to contain the second column from prefixes\_trimmed.csv, if a prefix match is made.

When tested, nothing is happening, no data is inserted.

Can you please help me with the correct translate sentence to make this work?

Best Regards,  
Mihai Radulescu

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [December 10, 2020, 4:33pm UTC](https://discuss.elastic.co/t/logstash-translate-doesnt-work/258249/2 "2020-12-10T16:33:22Z")

</div>

A translate filter does not match prefixes, it does exact matches by default. If you can modify the csv then the regex option to the filter may be useful.

---

<div class="post-metadata">

### Author: ![mihai.radulescu](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mihai.radulescu](https://discuss.elastic.co/u/mihai.radulescu)
#### Post date: [December 15, 2020, 9:29pm UTC](https://discuss.elastic.co/t/logstash-translate-doesnt-work/258249/3 "2020-12-15T21:29:41Z")

</div>

Hi Badger,  
Thanks for the answer.  
I think I managed to get around that.  
I have another question now. How do I make multiple translations?  
Best Regards,  
Mihai Radulescu

---

<div class="post-metadata">

### Author: ![mihai.radulescu](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mihai.radulescu](https://discuss.elastic.co/u/mihai.radulescu)
#### Post date: [December 17, 2020, 12:33pm UTC](https://discuss.elastic.co/t/logstash-translate-doesnt-work/258249/4 "2020-12-17T12:33:56Z")

</div>

Hi,  
I managed to make it working like this:

```auto
filter {
        translate {
...
        }

        translate {
...
        }
}

```

Best Regards,

---

<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: [January 14, 2021, 12:34pm UTC](https://discuss.elastic.co/t/logstash-translate-doesnt-work/258249/5 "2021-01-14T12:34:01Z")

</div>

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