Search code examples
jenkinscontinuous-integrationjenkins-plugins

How can I take last 20 lines from the $BUILD_LOG variable?


When using Email-ext plugin, I would like also to write the last 20 lines of the build log there (not attached as a file) I know I can access the log using $BUILD_LOG variable, but don't know exactly how to take the las 20 lines from that variable. Any help? Thanks a lot.


Solution

  • You could use the following syntax, from the Content Token reference:

    ${BUILD_LOG, maxLines, escapeHtml} - Displays the end of the build log. maxLines - display at most this many lines of the log. Defaults to 250. escapeHtml - If true, HTML is escaped. Defaults to false.