# Copy last uuid value in the configuration

**URL:** <https://discuss.elastic.co/t/copy-last-uuid-value-in-the-configuration/166825>\
**Category:** Logstash\
**Created:** [February 2, 2019, 4:10pm UTC](https://discuss.elastic.co/t/copy-last-uuid-value-in-the-configuration/166825 "2019-02-02T16:10:08Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [February 2, 2019, 4:42pm UTC](https://discuss.elastic.co/t/copy-last-uuid-value-in-the-configuration/166825/4 "2019-02-02T16:42:02Z")

</div>

Something like this should get you started.

```
input { generator { count => 1 lines => ['a1', 'b1', 'a2', 'b2'] } }
filter {
    if [message] =~ /^a/ {
        #start
        mutate { add_tag => ["sessionStart"] }
        fingerprint { target => "uuid" }
        ruby { code => '@@uuid = event.get("uuid")' }
    } else {
        #end
        mutate { add_tag => ["sessionEnd"] }
        ruby { code => 'event.set("uuid", @@uuid)' }
    }
}
output { stdout { } }
```

---

_[View the full topic](https://discuss.elastic.co/t/copy-last-uuid-value-in-the-configuration/166825)._
