diff --git a/server/datastore/mysql/hosts.go b/server/datastore/mysql/hosts.go index 387518f65f..eebacff3b0 100644 --- a/server/datastore/mysql/hosts.go +++ b/server/datastore/mysql/hosts.go @@ -1914,7 +1914,7 @@ func (ds *Datastore) DeleteHosts(ctx context.Context, ids []uint) error { func (ds *Datastore) FailingPoliciesCount(ctx context.Context, host *fleet.Host) (uint, error) { if host.FleetPlatform() == "" { // We log to help troubleshooting in case this happens. - level.Error(ds.logger).Log("err", fmt.Sprintf("host %d with empty platform", host.ID)) + level.Error(ds.logger).Log("err", "unrecognized platform", "hostID", host.ID, "platform", host.Platform) //nolint:errcheck } query := ` @@ -1937,7 +1937,7 @@ func (ds *Datastore) FailingPoliciesCount(ctx context.Context, host *fleet.Host) func (ds *Datastore) ListPoliciesForHost(ctx context.Context, host *fleet.Host) ([]*fleet.HostPolicy, error) { if host.FleetPlatform() == "" { // We log to help troubleshooting in case this happens. - level.Error(ds.logger).Log("err", fmt.Sprintf("host %d with empty platform", host.ID)) + level.Error(ds.logger).Log("err", "unrecognized platform", "hostID", host.ID, "platform", host.Platform) //nolint:errcheck } query := `SELECT p.*, COALESCE(u.name, '') AS author_name, diff --git a/server/datastore/mysql/policies.go b/server/datastore/mysql/policies.go index 97ae583a6f..a2299fa356 100644 --- a/server/datastore/mysql/policies.go +++ b/server/datastore/mysql/policies.go @@ -382,7 +382,7 @@ func (ds *Datastore) PolicyQueriesForHost(ctx context.Context, host *fleet.Host) if host.FleetPlatform() == "" { // We log to help troubleshooting in case this happens, as the host // won't be receiving any policies targeted for specific platforms. - level.Error(ds.logger).Log("err", fmt.Sprintf("host %d with empty platform", host.ID)) //nolint:errcheck + level.Error(ds.logger).Log("err", "unrecognized platform", "hostID", host.ID, "platform", host.Platform) //nolint:errcheck } q := dialect.From("policies").Select( goqu.I("id"),