How to Generate a Denylist From an AMF File

  • Updated


In some situations, it may be beneficial to not analyze certain classes at agent startup. This can help address some performance issues or if the class belongs to another profiler or agent that may interfere with startup. 

How To Create a Denylist

A denylist is a text file that lists one full class name per line:


One way to generate a denylist from an existing agent DEBUG log is to create an Action Message Format (.amf) file by analyzing the log with 
java -jar contrast.jar analyze-log /path/to/contrast-debug.log amf

The resulting file, javaaagent-XXXXX.amf, can be unzipped with unzip -d t javaagent-XXXXX.amf.

The target folder should contain the file ./t/timeline.json, which can be used to extract classes that were analyzed but can be ignored. The following shows a JQ query to get the required data:

jq -r '.data[] 
| select(.category=="ClassLoad")
| {class: .subcategory, result: .supportingData.result[0]}
| select(.result=="ANALYZED_IGNORED")
| .class' t/timeline.json
| sort
| uniq

Alternatively, there is an online version of JQ that does not require installation:

1.pngThe result can be saved to a plain text file.

How to Add a Denylist to the Agent Configuration

Once a Denylist has been created, it can be added to the agent configuration, such as the contrast_security.yaml via

blacklist: /path/to/denlylist.txt

Note:  You can get more info on this setting by running

           java -jar contrast.jar properties | grep -B 2 -A 10 denylisty.yaml. 

This does require an agent restart.

Alternate Option

Another option to add a denylist is to use the setting:

package_denylist: /path/to/denlylist.txt

The package_denylist can be used to ignore an entire packages instead of individual classes by providing a denylist file that lists one package name per line: 



Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request