Skip to content

Commit

Permalink
Add semantic conventions for log record ID (#3047)
Browse files Browse the repository at this point in the history
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 &
open-telemetry/oteps#97 (comment) 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>
  • Loading branch information
4 people committed Apr 6, 2023
1 parent 189cb12 commit 0902d5f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
18 changes: 18 additions & 0 deletions semantic_conventions/logs/general.yaml
Original file line number Diff line number Diff line change
@@ -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"]
1 change: 1 addition & 0 deletions specification/logs/semantic_conventions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 27 additions & 0 deletions specification/logs/semantic_conventions/general.md
Original file line number Diff line number Diff line change
@@ -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 -->

0 comments on commit 0902d5f

Please sign in to comment.