Does f5’s implementation of odata structures allow for filtering with “contains”?
ex. $filter=contains(hostname, ‘gtm’)
If so, can you provide an example?
Thanks,
Does f5’s implementation of odata structures allow for filtering with “contains”?
ex. $filter=contains(hostname, ‘gtm’)
If so, can you provide an example?
Thanks,
Is there a way to filter on Subcollections? such as this… mgmt/tm/ltm/pool?expandSubcollections=true&$filter=partition eq ‘partition name’ … This will display all the pools and their pool members but I want to further filter down and only show the partition, pool name, pool member, pool member ip and the monitor. I can’t seem to find any query examples on how to filter or select within a Subcollection. Thanks
You will want to script that, I don’t think a single query will give you the granularity you are looking for, but I’d be happy to be corrected.
Thanks so much for your reply but I have found something that has got me the information that I needed. Le me know your thoughts. I will post my output below minus the server names for security purposes
https://f5_ip/mgmt/tm/ltm/pool?expandSubcollections=true&$select=name,partition,monitor,membersReference/items/name,membersReference/items/address
I want to give credit to a user on here named Michael Jenkins that led me to this answer from a previous post he made on this page.
https://devcentral.f5.com/s/feed/0D51T00006j28P0SAI
Sample output
“kind”: “tm:ltm:pool:poolcollectionstate”,
“items”: [
{
“name”: “poolname_removed-8105”,
“partition”: “partitionname_removed”,
“monitor”: “/Common/monitorname_removed”,
“membersReference”: {
“items”: [
{
“name”: “removed01:8105”,
“address”: “ip_removed%10”,
“nameReference”: {
“link”: “https://localhost/mgmt/tm/ltm/node/~partitionname\_removed~removed01:8105?ver=14.1.0.6”
}
},
{
“name”: “removed02:8105”,
“address”: “removed%10”,
“nameReference”: {
“link”: “https://localhost/mgmt/tm/ltm/node/~partitionname\_removed~removed02:8105?ver=14.1.0.6”
}
}
]
}
Running version 14.1.2.6, how can I filter on date? I have an ASM where I want to get all requests after a certain date
https://{{hostname}}/mgmt/tm/asm/events/requests?$filter=requestPolicy/createdDatetime+gt+'2020-07-28T00:00:00Z'&$select=requestPolicy/name,requestPolicy/createdDatetime,virtualServerName,serverIp,id,url,acceptStatus,responseContentType,violations/violationReference,enforcementMode,responseDatetime,clientIp,enforcementState/attackTypeReferences&$top=1
The response is
{
"totalPages": 0,
"pageIndex": 1,
"selfLink": "https://localhost/mgmt/tm/asm/events/requests?$top=1&$select=requestPolicy%2Fname%2CrequestPolicy%2FcreatedDatetime%2CvirtualServerName%2CserverIp%2Cid%2Curl%2CacceptStatus%2CresponseContentType%2Cviolations%2FviolationReference%2CenforcementMode%2CresponseDatetime%2CclientIp%2CenforcementState%2FattackTypeReferences&ver=14.1.2&$filter=requestPolicy%2FcreatedDatetime%20gt%20%272020-07-28T00%3A00%3A00Z%27",
"kind": "tm:asm:events:requests:requestcollectionstate",
"startIndex": 1,
"itemsPerPage": 1,
"totalItems": 0,
"items": []
}
When I run a query filtering on a specific ASM policy name I receive over 30.000+ items/requests
https://{{hostname}}/mgmt/tm/asm/events/requests?$filter=requestPolicy/name+eq+'{{asm-policy-name}}'&$select=requestPolicy/name,requestPolicy/createdDatetime,virtualServerName,serverIp,id,url,acceptStatus,responseContentType,violations/violationReference,enforcementMode,responseDatetime,clientIp,enforcementState/attackTypeReferences&$top=1
{
"totalPages": 31980,
"pageIndex": 1,
"selfLink": "https://localhost/mgmt/tm/asm/events/requests?$top=1&$select=requestPolicy%2Fname%2CrequestPolicy%2FcreatedDatetime%2CvirtualServerName%2CserverIp%2Cid%2Curl%2CacceptStatus%2CresponseContentType%2Cviolations%2FviolationReference%2CenforcementMode%2CresponseDatetime%2CclientIp%2CenforcementState%2FattackTypeReferences&ver=14.1.2&$filter=requestPolicy%2Fname%20eq%20%27<asm-policy-name>%27",
"kind": "tm:asm:events:requests:requestcollectionstate",
"startIndex": 1,
"itemsPerPage": 1,
"totalItems": 31980,
"nextLink": "https://localhost/mgmt/tm/asm/events/requests?$skip=1&$top=1&$select=requestPolicy%2Fname%2CrequestPolicy%2FcreatedDatetime%2CvirtualServerName%2CserverIp%2Cid%2Curl%2CacceptStatus%2CresponseContentType%2Cviolations%2FviolationReference%2CenforcementMode%2CresponseDatetime%2CclientIp%2CenforcementState%2FattackTypeReferences&ver=14.1.2&$filter=requestPolicy%2Fname%20eq%20%27<asm-policy-name>%27",
"items": [
{
...
"responseDatetime": "2020-07-29T08:40:20Z",
...
}
]
}
I’ve also tried to run the same query with ‘requestDatetime’ but still no items returned.
Nevermind, I figured it out. Looks like the $filter only works on the field ‘requestDatetime’
https://{{hostname}}/mgmt/tm/asm/events/requests?$filter=requestDatetime+gt+'2020-07-28T00:00:00Z'&$top=1
which can be combined with
https://{{hostname}}/mgmt/tm/asm/events/requests?$filter=requestPolicy/name+eq+'{{asm-policy-name}}'+and+requestDatetime+gt+'2020-07-29T00:00:00Z'&$top=25
i want to get only one data like my picture,how do i filter ?