Hey Fleet team, I'm a bit confused about concept o...
# fleet
j
Hey Fleet team, I'm a bit confused about concept of label query and policy query. Do we have more official doc talk about them? I can only find few words for policy query. https://fleetdm.com/docs/rest-api/rest-api#policies What are their difference? In which scenario, we should define a label query or a policy query? Thanks!
g
Greetings Jason! Label Queries are used for organizing your hosts into groups or filtering based on the criteria. https://fleetdm.com/docs/configuration/configuration-files#labels Policy Queries should return "0" or "1" Meaning, is this host passing the policy? (this can get a bit confusing based on how wanting to display "No" or "Yes") Policy queries usually start with a
SELECT 1 FROM
You can also run Policy Queries on Labels
j
Thanks for your response! If I understand correct, we also treat label queries' results as "0" or "1". (Either in the group or not). So the queries have no difference? The difference between label and policy it that we use label to filter hosts. For policy, we try to run a policy query to get a result. Am I understanding this correct?
g
Correct! if returns something other than "0" Labels - Organize hosts for filtering/running live queries Policies - Check the compliance of the host
j
Got it, Thank you!