Hopefully this is the right board for my question, We are facing an issue creating a unique ID from the following inputs :
- datetime (can be present more than once in the same set, cannot not be present in 2 different sets)
- offset ( an integer representing each line position in the set, the offset will be reset when switching to next/previous set)
As output we would like to get a unique ID, which will be used for sorting purpose later.
The concrete example for this issue is the rotating logs files. They will be collected into same database/table and later-on they will be shown and sorted/filtered based on this unique id.
log1.txt (set 1)
- 2017-08-06 10:36:07,988 something (let say offset=54)
- 2017-08-06 10:36:07,988 something (let say offset=108)
- 2017-08-06 10:36:07,988 something (let say offset=162)
- 2017-08-06 10:40:06,488 something (let say offset=1200) => A
log2.txt (set 2)
- 2017-08-06 10:40:06,788 xyz (let say offset=20)
- 2017-08-06 10:40:07,488 xyz (let say offset=200) => B
Obviously a naïve uid function by adding offset as milliseconds to the date will lead to collusion, the frequency of the collusion cannot be foreseen, it depends on the logged text and the rotation size. (A & B for collusion example).