Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kauche/proxy-wasm-cloud-logging-trace-context
A proxy-wasm compilant WebAssembly module for making proxies integrate with Google Cloud Logging.
https://github.com/kauche/proxy-wasm-cloud-logging-trace-context
Last synced: 3 months ago
JSON representation
A proxy-wasm compilant WebAssembly module for making proxies integrate with Google Cloud Logging.
- Host: GitHub
- URL: https://github.com/kauche/proxy-wasm-cloud-logging-trace-context
- Owner: kauche
- License: mit
- Created: 2022-08-17T06:12:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-25T07:56:31.000Z (over 2 years ago)
- Last Synced: 2024-08-04T04:07:20.816Z (6 months ago)
- Language: Zig
- Homepage:
- Size: 9.77 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-zig - proxy-wasm-cloud-logging-trace-context๐๏ธA proxy-wasm compilant WebAssembly module for making proxies integrate with Google Cloud Logging
README
# proxy-wasm-cloud-logging-trace-context
A [proxy-wasm](https://github.com/proxy-wasm/spec) compliant WebAssembly module for making proxies integrate with [Google Cloud Logging](https://cloud.google.com/logging/).
## Overview
In order to generate logs associated with [Google Cloud Trace](https://cloud.google.com/trace) for [Google Cloud Logging](https://cloud.google.com/logging/), we need to add a [`logging.googleapis.com/trace` field](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.trace) to the log entries.
This [proxy-wasm](https://github.com/proxy-wasm/spec) compliant WebAssembly module helps proxies generate logs integrated with Cloud Logging and Cloud Trace by extracting the trace id from the `X-Cloud-Trace-Context` HTTP Header and populating `X-Cloud-Logging-Trace-Context` by using the extracted trace id. The populated `X-Cloud-Logging-Trace-Context` HTTP Header is formatted as `projects//traces/` and can be used to add a `logging.googleapis.com/trace` filed to logs.
## Usage
1. Download the latest WebAssembly module from the [release page](https://github.com/kauche/proxy-wasm-cloud-logging-trace-context/releases).
2. Configure the proxy to use the WebAssembly module and generate logs like below (this assumes [Envoy](https://www.envoyproxy.io/) as the proxy):
```yaml
access_log:
name: log
typed_config:
'@type': type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog
log_format:
json_format:
status: '%RESPONSE_CODE%'
message: access log
severity: INFO
component: envoy
logging.googleapis.com/trace: '%REQ(x-cloud-logging-trace-context)%'
http_filters:
- name: envoy.filters.http.wasm
typed_config:
'@type': type.googleapis.com/udpa.type.v1.TypedStruct
type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
value:
config:
vm_config:
runtime: envoy.wasm.runtime.v8
code:
local:
filename: /etc/envoy/proxy-wasm-cloud-logging-trace-context.wasm
configuration:
"@type": type.googleapis.com/google.protobuf.StringValue
value: |
{
"project_id": "my-projectid"
}
- name: envoy.filters.http.router
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
```