Hi Fleet team, <https://fleetdm.com/docs/using-fle...
# fleet
w
Hi Fleet team, https://fleetdm.com/docs/using-fleet/configuration-files#labels fleet actually store all the labels in labels table, right? and "manually managed" means by changing the cfg from fleet portal? And Is that the only way to change data in labels table?
k
When you create a label, it is stored in the
labels
table. A manually managed label is one that is applied to the list of hosts you provide rather than applied dynamically based on a query. The first example in the docs section you linked is a dynamic label and will run that query on hosts periodically and apply the label to hosts that match the condition set in the query.
Copy code
apiVersion: v1
kind: label
spec:
  name: slack_not_running
  query: >
    SELECT * FROM system_info
    WHERE NOT EXISTS (
      SELECT *
      FROM processes
      WHERE name LIKE "%Slack%"
    );
The second example is a manual label and will automatically be applied to the hosts listed:
Copy code
apiVersion: v1
kind: label
spec:
  name: Manually Managed Example
  label_membership_type: manual
  hosts:
    - hostname1
    - hostname2
    - hostname3
The table that stores data about which hosts belong to which label is
label_membership
. You can add, modify and remove labels using the Fleet configuration or the REST API
w
ok, it looks like the only diff between dynamic label and manual label is whether define the target hosts, right? And all of them are stored in labels table or some where else?
k
Correct, the difference is in how the label is applied.
Dynamic - You define a query. That query will be run against your hosts periodically and, if it returns a result, the host will become a member of that label.
Manual - You define a list of hosts and they become members of the label. Membership will only change if you modify the label.
Label definitions are stored in the
labels
table. Membership is stored in
label_membership
w
And the only way to define a label query is by fleet restful API?
k
Or with
fleetctl