Hey All! Quick question. When collecting Fleetdm o...
# fleet
d
Hey All! Quick question. When collecting Fleetdm osquery logs, is it possible to include the private IP address in the logs? So its easier for us to know which instance the logs are coming from? The UUID is not very convenient for us. The private IP is already included in the UI, is there a way to add that host IP into the logs?
g
Hey @Darshal Shah Decorators might be what you are looking for :) https://fleetdm.com/docs/configuration/agent-configuration#decorators
d
Thanks! So which type of query should I put there in order to get the IP address of the hosts? I put the following query but it turns green after I save it and I am not getting the IP address info. Can you please help?
I am not sure what it means if it turns green
k
You're seeing the green because you've wrapped the query in quotes. If you look at the osquery logs on your hosts, you'll likely see an error indicating that the decorator query is returning more than one row. Those queries need to be written so that they will only return one result per query.
Each decorator query should return at most 1 row. A warning will be generated if more than 1 row is returned as they will be forcefully ignored and constitute undefined behavior. Each decorator query should be careful not to emit column collisions, this is also undefined behavior.
https://osquery.readthedocs.io/en/stable/deployment/configuration/
d
So I didn’t wrap it in quotes. After I saved it, it wrapped itself into quotes, and turned green. I fixed that so that its now seperated into two different queries, and its not turning green anymore. But I am still not seeing the IP address in the logs
k
That's likely because this query would generally return more than one row of results.
You can run the query as a live query to confirm.
d
image.png
would this work? That should not return more than one row of results
k
I'd expect each of those queries to return multiple rows of results since there are multiple interface addresses.
Running as a live query should show multiple results for each host.
Getting the public IP is a bit challenging...
In Fleet, we're actually grabbing it from the headers of incoming requests from the host.
Is there another piece of information that would make it easier for you to identify your hosts?
system_info can be really helpful for grabbing identifying information.
And that only ever returns one row of results, so no concerns about narrowing down the results.
d
Thanks Kathy! Will give that a try
Hey @Kathy Satterlee, a follow up question. I want the hostname to show up on every scheduled query and just any query in general that is ran. So should it be under
load
,
always
, or
interval
? or all of them?
k
Those indicate when the decorator query should be rerun to update the values. Since hostname isn't likely to change frequently,
load
should be plenty frequent. load - updates every time config is loaded in osquery always - updates every time results are generated interval - updates every x seconds
d
Hey @Kathy Satterlee thanks for that. What could be the reason that none of the information under decoraters is in the logs?
do we need to enable any more settings?
k
Do you have any settings in “overrides”?
d
yes
image.png
k
You’ll need to include your full options in overrides as well. The two are not merged, so any hosts that match that platform are only getting the options specified in overrides.
d
so basically put this whole thing right under overrides?
or just the decorators?
k
Everything you want applied to that platform.
Rough outline incoming
d
Thanks a lot Kathy! I actually figured it out, and it seems to be working. But feel free to send the rough outline, I am sure it will come in handy in the future!
k
Making a visual that makes sense is proving to be more time consuming than anticipated 🙂 As long as it makes sense, you're golden.
d
Yes it does make sense. I think atleast lol. But yeah no worries thanks a lot for your help!!