Visit Support

Using the GC Log Scraper

Looking for Zing? The Azul Zing Virtual Machine is now Azul Zulu Prime Builds of OpenJDK and part of Azul Platform Prime. Learn more.

Azul Zulu Prime Builds of OpenJDK (Azul Zulu Prime JVM) Garbage Collector (GC) Log Scraper is a script that enables parsing of data from a GC log.

The script is located in <zing_directory>/etc/gcLogScraper.

To quickly get started with GC Log Scraper and see examples of extracting data, run gcLogScraper -h:

 $ ./gcLogScraper -h
Sample script that can be used to extract data from ZingVM GC log files

Usage: gcLogScraper -h
gcLogScraper -l <label> [-c <fmt_string>] < zing.gclog

-h - show this help and exit

-l <label> - gclog line marker (GC, GPGC-H, SYSINFO, OBJCREAT, COMPSTATS, SPS ...)

-c <fmt_string> - specifies what fields to print out
if fmt_string is not specified, the script prints the header line and exits

fmt_string may contain any text. Fields in the form of %{spec} will be replaced with the corresponding field
values extracted from the log

spec is the name of a field as it appears in the header line. For records that have two-line headers spec can be
specified in the form %{h1#h2}, where h1 unambiguously defines the group from the first header line and h2 specifies
a field from the second line within that group.


$ cat ${LOG} | gcLogScraper -l GC -c "%{end#end}: Type: %{type}; Mode: %{gc#md}; Pause 2: start=%{pause 2#start} dur=%{pause 2#dur}"
$ cat ${LOG} | gcLogScraper -l GPGC-H -c "%{Time} %{Model#NewGen};%{KID};%{ReasonString}"
$ cat ${LOG} | gcLogScraper -l OBJCREAT -c "%{end} %{newGen} %{permGen}" 

You can utilize the gcLogScraper script to write your own script to parse GC log files.

You may want to use the tail command to continuously extract metrics from a running Zing process, for example:

 tail -c +0 -f gc.log | -l GC -c '%{end}: %{rss}'