diff --git a/server/datastore/mysql/migrations/tables/20230706141219_QueriesTableSchemaChanges.go b/server/datastore/mysql/migrations/tables/20230706141219_QueriesTableSchemaChanges.go index cb6837f057..cf958d787e 100644 --- a/server/datastore/mysql/migrations/tables/20230706141219_QueriesTableSchemaChanges.go +++ b/server/datastore/mysql/migrations/tables/20230706141219_QueriesTableSchemaChanges.go @@ -31,7 +31,7 @@ func Up_20230706141219(tx *sql.Tx) error { ADD platform VARCHAR(255) DEFAULT NULL, ADD min_osquery_version VARCHAR(255) DEFAULT NULL, - ADD frequency_seconds INT(10) UNSIGNED DEFAULT 0, + ADD interval INT(10) UNSIGNED DEFAULT 0, ADD automations_enabled TINYINT(1) UNSIGNED DEFAULT 0, ADD logging_type VARCHAR(255) DEFAULT 'snapshot', diff --git a/server/fleet/queries.go b/server/fleet/queries.go index 025543c35a..c246102262 100644 --- a/server/fleet/queries.go +++ b/server/fleet/queries.go @@ -17,7 +17,21 @@ type QueryPayload struct { type Query struct { UpdateCreateTimestamps - ID uint `json:"id"` + ID uint `json:"id"` + // TeamID to which team this query belongs. If not set, then the query belongs to the 'Global' + // team. + TeamID *uint `json:"team_id" db:"team_id"` + // Interval frequency of execution (in seconds), if 0 then, this query will never run. + Interval uint `json:"interval" db:"interval"` + // Platform if set, specifies the platform(s) this query will target. + Platform *string `json:"platform" db:"platform"` + // MinOsqueryVersion if set, specifies the min required version of osquery that must be + // installed on the host. + MinOsqueryVersion *string `json:"min_osquery_version" db:"min_osquery_version"` + // AutomationsEnabled whether to send data to the configured log destination + AutomationsEnabled bool `json:"automations_enabled" db:"automations_enabled"` + // LoggingType the type of log output for this query + LoggingType string `json:"logging" db:"logging_type"` Name string `json:"name"` Description string `json:"description"` Query string `json:"query"`