Ulf Wiger proposal:
new_guid() ->
{node(), erlang:now()}.
export_guid({N,{Ms,S,Us}}) ->
lists:concat(
[atom_to_list(N),
".", integer_to_list(Ms),
".", integer_to_list(S),
".", integer_to_list(Us)]).
Rationale:
(1) The new_guid() function is really cheap
(2) It is also defined such that it is unique (unless
we start renaming hosts or messing with the system
clock.)
(3) It can be generated either manually or automatically
(even though when manually generated, you might want
to alter it somewhat (which is a Good Thing, since
we don't want conflicts betw manually and automatically
generated GUIDs.
(4) The GUID is reasonably readable, and can be re-formatted
for better readability (converting to date-time format)
(5) The GUID reflects where the entity was created, not
necessarily where it resides. In Command & Control,
the basic questions to answer are the 4 'W's:
Who?, What?, When?, Where? (*)
(+ sometimes, but not always, Why?)
(6) You may receive multiple indications of the same
thing, and must be able to tell the indications apart
(and do source credibility analysis). This basically
means "tag everything".
(7) I often also create a GUID for modified
(*) As in
- "Who is reporting?"
- "What happened?"
- "Where did it happen?"
- "When did it happen?" |