Digging into Jenkins source code, it gives the answer
* {@link ConsoleNote}s are serialized and gzip compressed into a byte sequence and then embedded into the
* console output text file, with a bit of preamble/postamble to allow tools to ignore them. In this way
* {@link ConsoleNote} always sticks to a particular point in the console output.
Look further, the AMBER
strings are defined. https://en.wikipedia.org/wiki/ANSI_escape_code
public static final String PREAMBLE_STR = "\u001B[8mha:";
public static final String POSTAMBLE_STR = "\u001B[0m";
I copied the first line of a test pipeline build log of my local installed Jenkins
Started by user [8mha:////4H+H6gi+RzqRXgbuxDkiDNvJYq3pMCu17+YXxGOB+mHbAAAAlx+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzWEgZu/dLi1CL9xJTczDwAj6GcLcAAAAA=[0madmin
The line can be split to following parts,
Part | Value |
---|---|
{A string} | Started by user |
{PREAMBLE_STR} | \u001B[8mha: |
{BASE64_STR} | ////4H+H6gi+RzqRXgbuxDkiDNvJYq3pMCu17+YXxGOB+mHbAAAAlx+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzWEgZu/dLi1CL9xJTczDwAj6GcLcAAAAA= |
{POSTAMBLE_STR} | \u001B[0m |
{A string} | admin |
-
Convert the
{BASE64_STR}
to bytes -
Trim the first
40
bytes (#1) -
Output to a
.gz
file, or stream whatever preferred. usegzip
method to extract
The extracted file, file
command tells me it's Java serialization data, version 5
, surely you can see plain text from it.
A sample of log file copied from my local installed Jenkins
A powershell implementation
#> & .\Decode-JenkinsRawLog.ps1
A python implementation
#> python3 Decode-JenkinsRawLog.py