[JIRA] (JENKINS-48344) Log files generated by Jenkins pipeline scripts are bloated

4 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Feb 9, 2018, 1:58:02 PM2/9/18
to jenkinsc...@googlegroups.com
Jesse Glick commented on Improvement JENKINS-48344
 
Re: Log files generated by Jenkins pipeline scripts are bloated

The fact that output is stored in two files—log, as with traditional job types, as well as 123.log per step—is a longstanding problem, to be corrected in JENKINS-38381. So that accounts for a factor of two.

(JENKINS-38381 also offers the capability for the single copy of the log file to be stored externally. You may use a bunch of disk space on some log server, but $JENKINS_HOME is unaffected.)

Then there are console notes, also used in traditional job types but used more widely in Pipeline builds, and consisting of Base64-encoded serialized data embedded in an ANSI escape sequence. These do tend to consume more space than the plain text of the line they appear on (and got bigger after a security fix, alas). However these should only be printed on a tiny fraction of the lines in a typical large build. For example, if you run a sh step, that [Pipeline] sh line will be annotated, but the potentially thousands of lines of output from the process should not be. So typically the contribution to log file size would be minor.

Since you claim to be seeing a far larger bloat (in each copy of the log file), and it sounds like you are seeing annotations on every line, something is going wrong. My guess is that you are using the timestamper block-scoped step, which in Pipeline mode does annotate every interior line. (For traditional jobs, unless overridden by a system property, it saves timestamp information to a side file. Also potentially big, though probably not as big.) Until we can think of a way to deal with that, for example by adjusting the Timestamper plugin to skip annotations on most lines if they are being spat out in rapid succession (few users care about millisecond precision in the middle of a 100kLOC log file!), you should try turning this wrapper off and see if that helps.

(And of course if we do have an external log service integration with JENKINS-38381, the service may do its own timestamping anyway.)

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Mar 21, 2018, 1:24:01 PM3/21/18
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Mar 21, 2018, 1:29:06 PM3/21/18
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
 
Jenkins / Bug JENKINS-48344

Demo; the junk goes away if you remove the timestamps step:

@Test
public void lines() throws Exception {
    WorkflowJob p = r.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition("timestamps {node {sh 'yes | head -1000'}}", true));
    WorkflowRun b = r.buildAndAssertSuccess(p);
    IOUtils.copy(b.getLogInputStream(), System.out);
}
Change By: Jesse Glick
Issue Type: Improvement Bug
Component/s: timestamper-plugin
Component/s: pipeline
Labels: performance pipeline

jglick@cloudbees.com (JIRA)

unread,
Sep 28, 2018, 8:55:03 AM9/28/18
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-48344
 
Re: Log files generated by Jenkins pipeline scripts are bloated

The API defined in JENKINS-45693 would allow there to be a system-wide option to add a simple timestamp prefix to every log line, which would be rendered nicely at least in the classic UI without ConsoleNote overhead.

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jglick@cloudbees.com (JIRA)

unread,
Sep 28, 2018, 6:57:06 PM9/28/18
to jenkinsc...@googlegroups.com
Jesse Glick started work on Bug JENKINS-48344
 
Change By: Jesse Glick
Status: Open In Progress

jglick@cloudbees.com (JIRA)

unread,
Sep 28, 2018, 6:57:06 PM9/28/18
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Sep 28, 2018, 6:58:04 PM9/28/18
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Sep 28, 2018, 6:58:04 PM9/28/18
to jenkinsc...@googlegroups.com
 
Re: Log files generated by Jenkins pipeline scripts are bloated

PR 25 is simple enough and basically solves this. Using ISO-8601 dates in plain text, which is reasonably compact, precise, and human-readable in case you are not using classic UI rendering.

jglick@cloudbees.com (JIRA)

unread,
Oct 16, 2018, 1:21:05 PM10/16/18
to jenkinsc...@googlegroups.com

medianick@gmail.com (JIRA)

unread,
Nov 7, 2018, 2:29:03 PM11/7/18
to jenkinsc...@googlegroups.com

Running the custom Timestamper plugin build in Jesse Glick's previous comment, on our test Jenkins instance, with a timestamps block in a Scripted Pipeline job but with the global "Enabled for all Pipeline builds" checkbox checked, I'm seeing 6681 "deprecated*.log" files – each the same size as the "log" file (2328MB) – created by a single build, all within a few minutes of each other. This is consuming 14GB+ of space for this one build, which would be catastrophic for disk space if we applied the same updates to our production Jenkins instance (where there are hundreds of jobs building hundreds of times per day).

This timestamps block is still in place because our production Jenkins system hasn't had its plugins changed, and uses the same Jenkinsfile for this particular job, and with the hundreds of jobs we have in place, coordinating the removal of a timestamps block in GitHub across all these Jenkinsfiles with the upgrade of the Timestamper (and/or other plugins) would be exceptionally difficult. I'm assuming (perhaps wrongly) that these "deprecated" files are being generated by some interaction between this block and the newer plugin(s) in this system, but perhaps it's something else.

Is the only way forward to remove all the timestamps blocks or options from all our Jenkinsfiles first, then upgrading these plugins? Or is something else going on?

medianick@gmail.com (JIRA)

unread,
Nov 7, 2018, 2:30:03 PM11/7/18
to jenkinsc...@googlegroups.com
Nick Jones edited a comment on Bug JENKINS-48344
Running the custom Timestamper plugin build in [~jglick]'s previous comment, on our test Jenkins instance, with a {{timestamps}} block in a Scripted Pipeline job but with the global "Enabled for all Pipeline builds" checkbox checked, I'm seeing 6681 "deprecated*.log" files -- each the same size as the "log" file (2328MB) -- created on our master node by a _single build_, all within a few minutes of each other. This is consuming 14GB+ of space for this one build, which would be catastrophic for disk space if we applied the same updates to our production Jenkins instance (where there are hundreds of jobs building hundreds of times per day).

This {{timestamps}} block is still in place because our production Jenkins system hasn't had its plugins changed, and uses the same Jenkinsfile for this particular job, and with the hundreds of jobs we have in place, coordinating the removal of a {{timestamps}} block in GitHub across all these Jenkinsfiles with the upgrade of the Timestamper (and/or other plugins) would be exceptionally difficult. I'm assuming (perhaps wrongly) that these "deprecated" files are being generated by some interaction between this block and the newer plugin(s) in this system, but perhaps it's something else.

Is the only way forward to remove all the {{timestamps}} blocks or options from all our Jenkinsfiles first, then upgrading these plugins? Or is something else going on?

jglick@cloudbees.com (JIRA)

unread,
Nov 7, 2018, 3:08:04 PM11/7/18
to jenkinsc...@googlegroups.com

Nick Jones no, with the global setting enabled the timestamps step/option does nothing besides print a warning that it is doing nothing. Your issue is some instance of JENKINS-54128, with the exact cause visible by checking the stack trace in your system log.

jglick@cloudbees.com (JIRA)

unread,
Feb 7, 2019, 3:36:07 PM2/7/19
to jenkinsc...@googlegroups.com
Change By: Jesse Glick
Status: In Review Resolved
Resolution: Fixed
Released As: 1.9

ullrich.hafner@gmail.com (JIRA)

unread,
Mar 22, 2019, 12:41:03 PM3/22/19
to jenkinsc...@googlegroups.com
Ulli Hafner commented on Bug JENKINS-48344
 
Re: Log files generated by Jenkins pipeline scripts are bloated

Jesse Glick I just came around this issue due to JENKINS-56484. Before Timestamper 1.9 I used ConsoleNote::removeNotes to get rid of additional console decorations when parsing warnings. This does obviously not work anymore. Is there a general way to remove the timestamper plugin output from the console log?

jglick@cloudbees.com (JIRA)

unread,
Mar 22, 2019, 1:28:08 PM3/22/19
to jenkinsc...@googlegroups.com

timur.ozdoev@gmail.com (JIRA)

unread,
Oct 9, 2019, 12:01:04 PM10/9/19
to jenkinsc...@googlegroups.com
Tim Oz commented on Bug JENKINS-48344

Please, help

I have the same issue on Jenkins ver. 2.176.1, Timestamper 1.10 and AnsiColor 0.6.2 plugins.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages