Skip to content

Commit

Permalink
Compiling client event table ignores missing artifacts (Velocidex#1220)
Browse files Browse the repository at this point in the history
If an artifact is added to the client monitoring table and then
deleted the client monitoring service will fail to load because it is
unable to recompile the missing artifact.

This PR makes it a non-fatal error, the event table will simply skip
the missing artifact.

Also some small fixes:
1. USN parser returns the time.Time object
2. UI shows JSON mode in raw json views
  • Loading branch information
scudette authored Aug 26, 2021
1 parent 4d3b404 commit 7d8b75e
Show file tree
Hide file tree
Showing 22 changed files with 552 additions and 412 deletions.
11 changes: 9 additions & 2 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ func (self *ApiServer) SetServerMonitoringState(
}

func (self *ApiServer) GetClientMonitoringState(
ctx context.Context, in *empty.Empty) (
ctx context.Context, in *flows_proto.GetClientMonitoringStateRequest) (
*flows_proto.ClientEventTable, error) {

defer Instrument("GetClientMonitoringState")()
Expand All @@ -794,7 +794,14 @@ func (self *ApiServer) GetClientMonitoringState(
"User is not allowed to read monitoring artifacts (%v).", permissions))
}

result := services.ClientEventManager().GetClientMonitoringState()
manager := services.ClientEventManager()
result := manager.GetClientMonitoringState()
if in.ClientId != "" {
message := manager.GetClientUpdateEventTableMessage(self.config,
in.ClientId)
result.ClientMessage = message
}

return result, err
}

Expand Down
2 changes: 1 addition & 1 deletion api/mock/api_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

476 changes: 239 additions & 237 deletions api/proto/api.pb.go

Large diffs are not rendered by default.

36 changes: 27 additions & 9 deletions api/proto/api.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ service API {

// Client Monitoring Artifacts - manage the Client Monitoring
// Service.
rpc GetClientMonitoringState(google.protobuf.Empty) returns (ClientEventTable) {
rpc GetClientMonitoringState(GetClientMonitoringStateRequest) returns (ClientEventTable) {
option (google.api.http) = {
get: "/api/v1/GetClientMonitoringState",
};
Expand Down
12 changes: 6 additions & 6 deletions api/proto/api_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/server_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func getServerMonitoringState(config_obj *config_proto.Config) (
result,
)
_ = err // if an error we return an empty collector args.

return result, nil
}

Expand Down
2 changes: 1 addition & 1 deletion file_store/test_utils/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ func (self *TestSuite) SetupTest() {
require.NoError(self.T(), self.Sm.Start(journal.StartJournalService))
require.NoError(self.T(), self.Sm.Start(notifications.StartNotificationService))
require.NoError(self.T(), self.Sm.Start(inventory.StartInventoryService))
require.NoError(self.T(), self.Sm.Start(repository.StartRepositoryManager))
require.NoError(self.T(), self.Sm.Start(launcher.StartLauncherService))
require.NoError(self.T(), self.Sm.Start(repository.StartRepositoryManager))
require.NoError(self.T(), self.Sm.Start(labels.StartLabelService))
}

Expand Down
Loading

0 comments on commit 7d8b75e

Please sign in to comment.