Skip to content

Commit 9cc37d0

Browse files
committed
Add semantic conventions for log media attributes
Logs are transmitted via several common media, such as files and iostreams. This PR establishes semantic conventions for describing the file or iostream from which a log was read. Notably, these attributes are not resource attributes, as the medium used to tranmit a log is not considered to be the originator of the log.
1 parent 5418462 commit 9cc37d0

File tree

4 files changed

+55
-2
lines changed

4 files changed

+55
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ release.
3838

3939
- Fix Syslog severity number mapping in the example.
4040
([#2091](https://github.com/open-telemetry/opentelemetry-specification/pull/2091))
41+
- Add log.* attributes.
42+
([#2022](https://github.com/open-telemetry/opentelemetry-specification/pull/2022))
4143

4244
### Resource
4345

specification/logs/data-model.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ Description: Additional information about the specific event occurrence. Unlike
426426
the `Resource` field, which is fixed for a particular source, `Attributes` can
427427
vary for each occurrence of the event coming from the same source. Can contain
428428
information about the request context (other than TraceId/SpanId). SHOULD follow
429-
OpenTelemetry
430-
[semantic conventions for Attributes](../trace/semantic_conventions/README.md).
429+
OpenTelemetry [semantic conventions for Log Attributes](./semantic_conventions/README.md) or
430+
[semantic conventions for Span Attributes](../trace/semantic_conventions/README.md).
431431
This field is optional.
432432

433433
#### Errors and Exceptions
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Log Attribute Semantic Conventions
2+
3+
**Status**: [Experimental](../../document-status.md)
4+
5+
The following semantic conventions for logs are defined:
6+
7+
* [Log Media](media.md): Semantic attributes that may be used in describing the source of a log.
8+
9+
Apart from semantic conventions for logs, [traces](../../trace/semantic_conventions/README.md), and [metrics](../../metrics/semantic_conventions/README.md),
10+
OpenTelemetry also defines the concept of overarching [Resources](../../resource/sdk.md) with their own
11+
[Resource Semantic Conventions](../../resource/semantic_conventions/README.md).
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Semantic Conventions for Log Media
2+
3+
**Status**: [Experimental](../../document-status.md)
4+
5+
This document describes attributes for log media in OpenTelemetry. Log media are mechanisms by which logs are transmitted. Types of media include files, streams, network protocols, and os-specific logging services such as journald and Windows Event Log.
6+
7+
<!-- Re-generate TOC with `markdown-toc --no-first-h1 -i` -->
8+
9+
<!-- toc -->
10+
11+
- [Log Media](#log-media)
12+
* [Log File](#log-file)
13+
* [I/O Stream](#io-stream)
14+
15+
<!-- tocstop -->
16+
17+
## Log Media
18+
19+
**Note:** The OpenTelemetry specification defines a [Resource](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#resource-sdk) as `an immutable representation of the entity producing telemetry`.
20+
The following attributes do not describe entities that produce telemetry. Rather, they describe mechanisms of log transmission.
21+
As such, these should be recorded as Log Record attributes when applicable. They should not be recorded as Resource attributes.
22+
23+
### Log File
24+
25+
**Description:** A file to which log was emitted.
26+
27+
| Name | Notes and examples |
28+
| ------------------------------- | ---------------------------------------------------------------------------------------- |
29+
| `log.file.name` | The basename of the file. Example: `audit.log` |
30+
| `log.file.path` | The full path to the file. Example: `/var/log/mysql/audit.log` |
31+
| `log.file.name_resolved` | The basename of the file, with symlinks resolved. Example: `uuid.log` |
32+
| `log.file.path_resolved` | The full path to the file, with symlinks resolved. Example: `/var/lib/docker/uuid.log` |
33+
34+
### I/O Stream
35+
36+
**Description:** The I/O stream to which the log was emitted.
37+
38+
| Name | Notes and examples |
39+
| ------------------------------- | ---------------------------------------------------------------------------------------- |
40+
| `log.iostream` | The stream associated with the log. SHOULD be one of: `stdout`, `stderr` |

0 commit comments

Comments
 (0)