# How to perform checksum

**URL:** <https://discuss.elastic.co/t/how-to-perform-checksum/139634>\
**Category:** Logstash\
**Created:** [July 11, 2018, 7:08pm UTC](https://discuss.elastic.co/t/how-to-perform-checksum/139634 "2018-07-11T19:08:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![James4](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@James4](https://discuss.elastic.co/u/James4)\
**Post date:** [July 11, 2018, 7:08pm UTC](https://discuss.elastic.co/t/how-to-perform-checksum/139634/1 "2018-07-11T19:08:29Z")

</div>

I have a field that contains a list of "tags/keywords" (around 60) but they can come in any order. I want to be able to search the index for all documents with same combination of "tags/keywords" . So I thought I could just checksum the field and store the value in another field for comparison/search/aggregations. It's not perfect, but in combination with other fields I have to reduce the set, I think it would do a very good job.

My problem is the checksum input has been replaced with fingerprint and as far as I can tell does not have checksum.

I am not that accomplished in logstash or ruby, so I am hoping there is a workaround and I don't have to sort the list, then fingerprint, but that may be what I have to do.

Any pointers are appreciated.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 11, 2018, 8:57pm UTC](https://discuss.elastic.co/t/how-to-perform-checksum/139634/2 "2018-07-11T20:57:11Z")

</div>

The fingerprint filter works fine. Just pick an inexpensive algorithm like MD5.

To sort the list, a ruby filter with

```
event.get('fieldname').sort! if event.get('fieldname')

```

probably works.

---

<div class="post-metadata">

**Author:** ![James4](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@James4](https://discuss.elastic.co/u/James4)\
**Post date:** [July 12, 2018, 8:07pm UTC](https://discuss.elastic.co/t/how-to-perform-checksum/139634/3 "2018-07-12T20:07:13Z")

</div>

Thank you Magnus.

Here is what worked for me. My list of entries was separated by comma. I also used temporary variable so I could "see" on elastic that I was getting what I expected.

```
    mutate{
            split => { "band" => "," }
    }
    ruby {
        code => 'event.set("band2", event.get("band").sort) '
    }

    fingerprint {
        source => "band2"
        target => "[band_md5]"
        method => "MD5"
        concatenate_sources => true
        key => "md5 band"
        base64encode => 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:** [August 9, 2018, 8:07pm UTC](https://discuss.elastic.co/t/how-to-perform-checksum/139634/4 "2018-08-09T20:07:25Z")

</div>

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