# Why does translate not work for me?

**URL:** https://discuss.elastic.co/t/why-does-translate-not-work-for-me/347478
**Category:** Logstash
**Created:** [November 19, 2023, 4:55pm UTC](https://discuss.elastic.co/t/why-does-translate-not-work-for-me/347478 "2023-11-19T16:55:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![andre22](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@andre22](https://discuss.elastic.co/u/andre22)
#### Post date: [November 19, 2023, 4:55pm UTC](https://discuss.elastic.co/t/why-does-translate-not-work-for-me/347478/1 "2023-11-19T16:55:57Z")

</div>

Hi,

I can't wrap my head around why I don't get this translate filter to work.  
I have a bunch of IoT logfiles (csv) that I want to import.

- One of the fields (KO-ID) does contain an internal ID of the old log engine, for example "3051"
- another field (GrpAdr) contains the ID I need to work with in the future. Because it is not available for all log entries, I want to substitute this GrpAdr for a range of old IDs (3050 to 3101). In other words: if KO-ID is in the range above, use the lookup table to overwrite whatever there is in GrpAdr (it should be empty anyway).

KO-ID and GrpAdr both populate the correct fields when I import the log files. However, I cannot get the translation to work (also tried a dictionary instead of lookup file). GrpAdr is always empty for the values in the range, but it has values when they are in the original log.

current config:

```auto
filter {
 ... 
  if "knximport" in [tags] {

    csv {
      columns => ["eventtime", "Funktion", "Geschoss", "Gewerk", "KNX-Name", "KNX-Wert", "KNX-Wert-Float", "Name", "Raum", "GrpAdr", "KOID", "PA", "Typ"]
      separator => ","
    }

    translate {
      source => "[KOID]"
      target => "[GrpAdr]"
      dictionary => {
        "3050" => "7/0/0"
        "3051" => "7/0/1"
        "3052" => "7/0/2"
        ...
        "654" => "11/2/3"
        "669" => "11/2/4"
      }
      fallback => "%{GrpAdr}" 
    }

```

I tried the field name with and without brackets, and several other things. However, the result is always the same:

 ![grafik](https://us1.discourse-cdn.com/elastic/original/3X/4/6/46c86c7527876910dad547d1af4ffef44eb633e0.png)

Here is a snippet from what I am importing:

```auto
2023-09-10T10:30:00.150Z,,,,Zirkulation,-29.9,,no match,,-,3056,,INTERN
2023-09-10T10:30:00.156Z,,,,Brauchwasser Solltemperatur,50,,no match,,-,3060,,INTERN
2023-09-10T10:30:00.160Z,,,,Betriebsart,3,,no match,,-,3064,,INTERN
2023-09-10T10:30:00.165Z,,,,Fusspunkt,35,,no match,,-,3068,,INTERN
2023-09-10T10:30:00.170Z,,,,Heizgrenze Absenken,10,,no match,,-,3072,,INTERN
2023-09-10T10:30:00.175Z,,,,Spreizung Heizkreis,20,,no match,,-,3076,,INTERN

```

What am I missing?

---

<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: [November 19, 2023, 5:21pm UTC](https://discuss.elastic.co/t/why-does-translate-not-work-for-me/347478/2 "2023-11-19T17:21:08Z")

</div>

> [@andre22](#):
>
> What am I missing?

GrpAdr will always exist, even if it is empty, so you need to set the [override](https://www.elastic.co/guide/en/logstash/current/plugins-filters-translate.html#plugins-filters-translate-override) option on the translate filter, otherwise the filter will not replace it.

---

<div class="post-metadata">

### Author: ![andre22](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@andre22](https://discuss.elastic.co/u/andre22)
#### Post date: [November 19, 2023, 5:45pm UTC](https://discuss.elastic.co/t/why-does-translate-not-work-for-me/347478/3 "2023-11-19T17:45:08Z")

</div>

That was it, thank you very much!

---

<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: [December 17, 2023, 5:45pm UTC](https://discuss.elastic.co/t/why-does-translate-not-work-for-me/347478/4 "2023-12-17T17:45:36Z")

</div>

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