Documentation
¶
Overview ¶
Package gcplog pulls log entries from GCP Cloud Logging and converts them into the workspace NDJSON envelope defined by ADR 0006.
Index ¶
Constants ¶
const DefaultSeverity = "DEFAULT"
DefaultSeverity is GCP's severity for entries without an explicit level.
Variables ¶
This section is empty.
Functions ¶
func CombinedFilter ¶
CombinedFilter joins the resolved time range with the user supplied filter. The time range is a separate concept from the filter; they are only combined here at query time.
func ConvertEntry ¶
ConvertEntry converts one GCP log entry into one envelope NDJSON line without a trailing newline. The timestamp is normalized to RFC3339 UTC, a missing severity becomes DEFAULT, jsonPayload is kept as is (compacted to a single line), and textPayload becomes {"message": <text>}. Provider metadata such as labels, trace, and resource is intentionally dropped here; it belongs in the ImportRun record, not in the log lines.
Types ¶
type Entry ¶
type Entry struct {
Timestamp time.Time `json:"timestamp"`
Severity string `json:"severity,omitempty"`
JSONPayload json.RawMessage `json:"jsonPayload,omitempty"`
TextPayload *string `json:"textPayload,omitempty"`
}
Entry is one GCP Cloud Logging entry, using the REST JSON field names. At most one of JSONPayload and TextPayload is set. TextPayload is a pointer so a present but empty text payload stays distinguishable from an absent one.
type FetchRequest ¶
FetchRequest describes one pull from GCP Cloud Logging. Filter is the user supplied Cloud Logging filter; the time range is combined with it when querying. Limit caps the number of returned entries.
type FetchResult ¶
type FetchResult struct {
Truncated bool
}
FetchResult reports facts about one completed fetch.
func Fetch ¶
func Fetch(ctx context.Context, req FetchRequest, writeLine func(string) error) (FetchResult, error)
Fetch pulls matching entries from GCP Cloud Logging using Application Default Credentials and sends each converted NDJSON line to writeLine.