Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Management API to stream agent logs #1655

Open
kralicky opened this issue Aug 15, 2023 · 0 comments · May be fixed by #1774
Open

Management API to stream agent logs #1655

kralicky opened this issue Aug 15, 2023 · 0 comments · May be fixed by #1774

Comments

@kralicky
Copy link
Member

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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants