Skip to content

Commit

Permalink
stackdriver: amend special fields docs
Browse files Browse the repository at this point in the history
  • Loading branch information
braydonk committed Dec 5, 2023
1 parent 58fcb7a commit 28cc0d5
Showing 1 changed file with 42 additions and 32 deletions.
74 changes: 42 additions & 32 deletions pipeline/outputs/stackdriver_special_fields.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
# Stackdriver Special fields

When the [google-logging-agent](https://cloud.google.com/logging/docs/agent) receives a structured log record, it treats the [some fields](https://cloud.google.com/logging/docs/agent/configuration#special-fields) specially, allowing users to set specific fields in the LogEntry object that get written to the Logging API.
When the [google-logging-agent](https://cloud.google.com/logging/docs/agent) receives a structured log record, it treats [some fields](https://cloud.google.com/logging/docs/agent/configuration#special-fields) specially, allowing users to set specific fields in the LogEntry object that get written to the Logging API.

Currently, we also support some special fields in fluent-bit:
| JSON log field | [LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) field | Logging agent function |
## Log Entry Fields

Currently, we support some special fields in fluent-bit for setting fields on the LogEntry object:
| JSON log field | [LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) field | Description |
| :--- | :--- | :--- |
| logging.googleapis.com/operation | operation | Additional information about a potentially long-running operation |
| logging.googleapis.com/labels | labels | The value of this field should be a structured record |
| logging.googleapis.com/insertId | insertId | A unique identifier for the log entry. It is used to order logEntries |
| logging.googleapis.com/sourceLocation | sourceLocation | Additional information about the source code location that produced the log entry. |
| logging.googleapis.com/http_request | httpRequest | A common proto for logging HTTP requests. |
| logging.googleapis.com/trace | trace | Resource name of the trace associated with the log entry |
| logging.googleapis.com/traceSampled | traceSampled | The sampling decision associated with this log entry. |
| logging.googleapis.com/spanId | spanId | The ID of the trace span associated with this log entry. |
| timestamp | timestamp | An object including the seconds and nanos fields that represents the time |
| timestampSecond & timestampNanos | timestamp | The seconds and nanos that represents the time |

## Other Special Fields

| JSON log field | Description |
| :--- | :--- |
| logging.googleapis.com/projectId | Changes the project ID that this log will be written to. Ensure that you are authenticated to write logs to this project. |

## Operation
Operation field contains additional information about a potentially long-running operation with which a log entry is associated.

Expand Down Expand Up @@ -239,7 +249,7 @@ the logEntry will be:
```

## httpRequest
HttpRequest field is a common proto for logging HTTP requests.
HttpRequest field is a common proto for logging HTTP requests.

The JSON representation is as followed:
```text
Expand Down Expand Up @@ -268,20 +278,20 @@ Set the input log as followed:
```text
jsonPayload {
"logging.googleapis.com/http_request": {
"requestMethod":"GET",
"requestUrl":"logging.googleapis.com",
"requestSize":"12",
"status":200,
"responseSize":"12",
"userAgent":"Mozilla",
"remoteIp":"255.0.0.1",
"serverIp":"255.0.0.1",
"referer":"referer",
"latency":"1s",
"cacheLookup":true,
"cacheHit":true,
"cacheValidatedWithOriginServer":true,
"cacheFillBytes":"12",
"requestMethod":"GET",
"requestUrl":"logging.googleapis.com",
"requestSize":"12",
"status":200,
"responseSize":"12",
"userAgent":"Mozilla",
"remoteIp":"255.0.0.1",
"serverIp":"255.0.0.1",
"referer":"referer",
"latency":"1s",
"cacheLookup":true,
"cacheHit":true,
"cacheValidatedWithOriginServer":true,
"cacheFillBytes":"12",
"protocol":"HTTP/1.2"
}
...
Expand All @@ -294,20 +304,20 @@ the logEntry will be:
...
}
"httpRequest": {
"requestMethod":"GET",
"requestUrl":"logging.googleapis.com",
"requestSize":"12",
"status":200,
"responseSize":"12",
"userAgent":"Mozilla",
"remoteIp":"255.0.0.1",
"serverIp":"255.0.0.1",
"referer":"referer",
"latency":"1s",
"cacheLookup":true,
"cacheHit":true,
"cacheValidatedWithOriginServer":true,
"cacheFillBytes":"12",
"requestMethod":"GET",
"requestUrl":"logging.googleapis.com",
"requestSize":"12",
"status":200,
"responseSize":"12",
"userAgent":"Mozilla",
"remoteIp":"255.0.0.1",
"serverIp":"255.0.0.1",
"referer":"referer",
"latency":"1s",
"cacheLookup":true,
"cacheHit":true,
"cacheValidatedWithOriginServer":true,
"cacheFillBytes":"12",
"protocol":"HTTP/1.2"
}
...
Expand Down

0 comments on commit 28cc0d5

Please sign in to comment.