Data going into zap.log

95 views
Skip to first unread message

Naveen Rajamannar

unread,
Mar 6, 2023, 5:36:37 AM3/6/23
to OWASP ZAP User Group
Hi,

Can we send assert details of standalone scripts to zap.log files?

Thanks,

thc...@gmail.com

unread,
Mar 6, 2023, 5:41:32 AM3/6/23
to zaprox...@googlegroups.com

Naveen Rajamannar

unread,
Mar 6, 2023, 11:07:58 AM3/6/23
to OWASP ZAP User Group
Thanks, I tried to implement the following code 

var LoggerManager = Java.type("org.apache.logging.log4j.LogManager");
var log = LoggerManager.getLogger("SSTI");

log.debug("-------------------HELLO-----------------------")


But did not see any logs in the zap.log file. Is this right way doing?
Screenshot 2023-03-06 at 5.18.52 PM.png

thc...@gmail.com

unread,
Mar 6, 2023, 11:32:04 AM3/6/23
to zaprox...@googlegroups.com
It's the right way to do it but debug level is not enabled by default,
try with info or error.

Alternatively, enable debug level for that name:
https://www.zaproxy.org/faq/how-do-you-configure-zap-logging/


Best regards.

Naveen Rajamannar

unread,
Mar 6, 2023, 12:00:56 PM3/6/23
to OWASP ZAP User Group
Thanks a lot that helped, one last question, What is the syntax to write for a particular name. is the following correct for a standalone scripte "org.zaproxy.zap.extension.standAlone.WriteAlertsToFile" : Level.DEBUG,

Naveen Rajamannar

unread,
Mar 6, 2023, 12:16:45 PM3/6/23
to OWASP ZAP User Group
Hi, Also can I change the pattern to JSON
Thanks,

On Monday, 6 March 2023 at 22:02:04 UTC+5:30 thc202 wrote:
Screenshot 2023-03-06 at 10.46.20 PM.png

thc...@gmail.com

unread,
Mar 7, 2023, 3:59:21 AM3/7/23
to zaprox...@googlegroups.com
That's the name you provide when getting the logger, in the example you
posted it would be "SSTI".

Best regards.

thc...@gmail.com

unread,
Mar 7, 2023, 4:08:08 AM3/7/23
to zaprox...@googlegroups.com
That's a Log4j2 question rather than ZAP one, looking at their docs it
seems to be possible:
https://logging.apache.org/log4j/2.x/manual/json-template-layout.html

Note that you can write to a custom file the JSON yourself (e.g.
JSON.stringify an object).
There are examples in the Community Scripts repo on how to write to
files from the scripts, e.g.:
https://github.com/zaproxy/community-scripts/blob/6b0ed32946b01b421c87c71baa43efcd666cf6bc/httpsender/LogMessages.js

Best regards.

Naveen Rajamannar

unread,
Mar 7, 2023, 11:55:21 AM3/7/23
to OWASP ZAP User Group
Thanks, will go through
Reply all
Reply to author
Forward
0 new messages