How to perform checksum


#1

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.


(Magnus B├Ąck) #2

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.


#3

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
    }

(system) #4

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