Add semantic conventions for log record ID (#3047)

Fixes #597

## Changes

- Add a section for "generic attributes" to the log semconv
- Add an attribute `log_record.id` making use of ULID as discussed in
#597

Some additional notes:
- I kept the PR small, so I left out some other potential attributes,
e.g. something for pre-existing ID (like windows event logs) or for
storing the used logging/eventing system or even something like a
"signature" that might be worth discussing, etc.
- I followed the structure of "generic attributes" from the spans
semconv
- I took some of the existing wording from #597 &
https://github.com/open-telemetry/oteps/pull/97#discussion_r421865344 to
describe the field

---------

Signed-off-by: svrnm <neumanns@cisco.com>
Co-authored-by: Joao Grassi <joao@joaograssi.com>
Co-authored-by: jack-berg <34418638+jack-berg@users.noreply.github.com>
Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>
This commit is contained in:
Severin Neumann 2023-04-06 19:14:26 +02:00 committed by GitHub
parent 189cb12e7a
commit 0902d5f429
3 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,18 @@
groups:
- id: log.record
prefix: log.record
brief: >
The attributes described in this section are rather generic. They may be used in any Log Record they apply to.
attributes:
- id: uid
type: string
requirement_level: opt_in
brief: >
A unique identifier for the Log Record.
note: >
If an id is provided, other log records with the same id will be considered duplicates and can be removed safely.
This means, that two distinguishable log records MUST have different values.
The id MAY be an [Universally Unique Lexicographically Sortable Identifier (ULID)](https://github.com/ulid/spec),
but other identifiers (e.g. UUID) may be used as needed.
examples: ["01ARZ3NDEKTSV4RRFFQ69G5FAV"]

View File

@ -4,6 +4,7 @@
The following semantic conventions for logs are defined:
* [General](general.md): General semantic attributes that may be used in describing Log Records.
* [Log Media](media.md): Semantic attributes that may be used in describing the source of a log.
The following semantic conventions for events are defined:

View File

@ -0,0 +1,27 @@
# General attributes
**Status**: [Experimental](../../document-status.md)
The attributes described in this section are rather generic.
They may be used in any Log Record they apply to.
<!-- Re-generate TOC with `markdown-toc --no-first-h1 -i` -->
<!-- toc -->
- [General log identification attributes](#general-log-identification-attributes)
<!-- tocstop -->
## General log identification attributes
These attributes may be used for identifying a Log Record.
<!-- semconv log.record -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `log.record.uid` | string | A unique identifier for the Log Record. [1] | `01ARZ3NDEKTSV4RRFFQ69G5FAV` | Opt-In |
**[1]:** If an id is provided, other log records with the same id will be considered duplicates and can be removed safely. This means, that two distinguishable log records MUST have different values.
The id MAY be an [Universally Unique Lexicographically Sortable Identifier (ULID)](https://github.com/ulid/spec), but other identifiers (e.g. UUID) may be used as needed.
<!-- endsemconv -->