This repository was archived by the owner on Feb 28, 2025. It is now read-only.
This repository was archived by the owner on Feb 28, 2025. It is now read-only.
Management API to stream agent logs #1655
Open
Description
We should implement a simple management API to allow viewing logs for any connected agent. An API should look something like this:
package control;
service Log {
// Streams logs from the agent according to the parameters specified in the request.
// The stream will be closed when the newest requested log is sent, unless 'follow'
// is true, in which case the stream will remain open indefinitely and continue to
// send logs in real time as they are generated.
rpc StreamLogs(LogStreamRequest) returns (stream StructuredLogRecord);
}
message LogStreamRequest {
google.protobuf.Timestamp since = 1;
google.protobuf.Timestamp until = 2;
repeated LogStreamFilter filters = 3;
bool follow = 4;
}
message LogStreamFilter {
// A glob pattern to match against the logger name. For example, "plugin.*"
// will match all plugin loggers.
optional string namePattern = 1;
// Minimum log severity level to include in the stream.
optional int32 level = 2;
}
// Represents a single structured log message. Roughly analagous to slog.Record.
message StructuredLogRecord {
google.protobuf.Timestamp time = 1;
string message = 2;
repeated Attr attributes = 3;
}
// A key-value pair analagous to slog.Attr.
message Attr {
string key = 1;
google.protobuf.Any value = 2;
}