Saving job log as text file?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Saving job log as text file?

karlis purens
Hello,

How can Jenkins job console be saved as a text file on slave machine?

I am working with a project that generates long and complex console logs - that are later analyzed for determining potential problems.

At the moment after each build i have to login to jenkins and manually copy the console to a text file, which is then analyzed. (you can see how cumbersome that is)

I have tried looking for console output in the job workspace of slave machine, but no files are generated in the workspace.
I have also tried saving the file from console by downloading the contents of job console url, but haven't found any suitable commands.

Slave machine is running on Windows 7
Using wget is not possible in this case because of restricted access.

Any help would be greatly appreciated.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d6845c35-4efd-4fd7-9f22-9835f5625338%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Saving job log as text file?

karlis purens
For future reference if anyone else stumbles upon a similar problem:

I couldn't find a way to download console logs.
But it's possible to open console logs on the slave machine using %BUILD_URL%consoleText

So i executed a post-build-task cmd: start "" "%BUILD_URL%consoleText"
This opens job console plaintext in your default broswer (chrome in my case)

And it just so happens that chrome has an excellent extension called Tampermonkey - which can execute any javascript code on webpage startup.
So i made a bunch of if statements using tampermonkey's javascript which are executed when the console url is opened.
(Beware - there are problems with closing the tab, if you want to close the tab after you're done, put it inside a separate tampermonkey script)

And there it is - fully automated console text parser.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/125dcf9e-c39e-4e0b-ad5f-82fc4e9adf60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Saving job log as text file?

alex.tiunov
0

Log location:

${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/log

MAC: Get log as a text and save to workspace:

cat ${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/log >> log.txt


WINDOWS: Get log as a text and save to workspace:

type ${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/log > log.txt


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b9622176-29a7-4dab-8516-ca7115c2e862%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.