Forum Discussion
Export single ASM Event Log over API
- Aug 01, 2022
Hello,
After days of debugging, I discovered that I am querying the support id as a List object.
As a result, API does not return an error instead, the particular place is empty. After changing it to a string and everything works as expected.
Can you provide some more insight on how you resolved this? I'm trying to do the same ("Export single ASM Event Log over API"), following this guide: https://support.f5.com/csp/article/K50284219
I receive an html file which is useless, because it contains only a header with f5 logo and some metadata, but no details on the specific event ID at all. Although the html only displays very few lines, it is also about 800kb in size, but this seems to be due to the fact that it contains some java script that brings along a lot of static basic stuff like country codes, descriptions of violations and such.
Is this the same error you enconuntered? If so, can you point out what you mean by "querying the support id as a List object" and "changing it to a string"?
It has been a few years since I looked into the report generation process, so you may need to do some sniffing of the requests the webui makes through Developer Tools in your browser and double check this still works.
The following call is one I used to grab the report data in JSON format, this is in Python. Set the $filter attribute in the query paramater (aka the variable exampleid in this case) to match the appropriate support ID number. Send this URL via requests as a GET query:
url = "/mgmt/tm/asm/events/requests?$expand=violations%2FcontentProfileReference%2Cviolations%2FpolicyEntityReference%2Cviolations%2FsignatureReference%2Cviolations%2FhttpSubviolationReference%2F*%2Cviolations%2FwssSubviolationReference%2F*%2Cviolations%2FevasionSubviolationReference%2F*%2CrequestPolicyReference&$select=*%2CrequestPolicy%2FfullPath%2CrawRequest%2F*%2CrawResponse%2F*%2CenforcementState%2F*&$top=100&ver=13.1.1&$filter=id%20eq%20'{exampleid}'&servertime=true&$orderBy=requestDatetime%20desc%2Cid%20desc".format(exampleid=exampleid)
After obtaining the data, if you want to use it in the HTML template it normally goes into, I found it necessary to set the encoding to utf-8 before base64 encoding it. Otherwise as it is just a big JSON file, you can do whatever you want with it.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com