-
I am trying to get the ID of a host group, by querying it via queryHostGroups. When I try to do kike this:
the result set is always empty. I can, however query host groups by either e.g. group_type or created_by, its just the name filter, which never returns any object. The response when querying for name as the filter returns this responde, regardless if <group_name> is an existing group name or not.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Well that's interesting... The FQL rule for an exact match says your filter should be I'll investigate for more detail regarding the preferred exact match syntax for these two operations. In the interim, I have a workaround that I think should work for most scenarios. Hint that you're wildcarding, but don't actually provide a wildcard.import os
from falconpy import HostGroup
groups = HostGroup(client_id=os.getenv("CLIENT_ID"), client_secret=os.getenv("CLIENT_SECRET"))
GROUP_NAME = "This is my test group name"
# This one will return zero results
groups.query_host_groups(filter=f"name:['{GROUP_NAME}']")
# This one will also return zero results
groups.query_host_groups(filter=f"name:'{GROUP_NAME}'")
# This one should work, we provide the hint with no actual wildcards
groups.query_host_groups(filter=f"name:*'{GROUP_NAME}'") |
Beta Was this translation helpful? Give feedback.
-
Yeah - I found out the same just yesterday evening, when I changed my filter accordingly to what you also provided:
I was a bit surprised, since the examples I saw on this discussion group didn't utilize the wildcard hint and I was wondering, if I maybe had done something wrong. However, since you came up with the same workaround, I will go with that for the time being and see, if you can uncover as of why this has to be done this way. Other than that - this is really an awesome piece of work! |
Beta Was this translation helpful? Give feedback.
Well that's interesting...
The FQL rule for an exact match says your filter should be
property:['string']
instead ofproperty:'string'
. My testing produces the same behavior you have identified; both variations of this syntax produce zero results when provided to the queryHostGroups and queryCombinedHostGroups operations.I'll investigate for more detail regarding the preferred exact match syntax for these two operations. In the interim, I have a workaround that I think should work for most scenarios.
Hint that you're wildcarding, but don't actually provide a wildcard.