How do I read system/messages outside TeamCity?

Hi,

I would like to Splunk the build logs that are stored by the TeamCity server in system/messages, but they are encoded in a non-human-readable format.

How can I decode this format in order that Splunk may eat it?

Thanks,
-chris

3 comments
Comment actions Permalink

You can download build log by sending http request:
http://server/httpAuth/downloadBuildLog.html?buildId=<build id>

Or you can use guest authentication if guest is enabled:
http://server/guestAuth/downloadBuildLog.html?buildId=<build id>

In this case you will get log in text format. You can also write a plugin and serialize log in the format you want.

0
Comment actions Permalink

Thanks Pavel!  Can you point me to an example of a plugin that modifies logfile formats?

We would like to point a Splunk forwarder at the messages directory on the TC server and have it eat whatever is in there, which will work if everything under messages is stored in the original non-encoded format of the build log.  Are you saying that a plugin is able to drop logs into system/messages in non-encoded format?

-chris

0
Comment actions Permalink

I do not have an example, but I can point you to some docs:
- general information about TeamCity plugins: http://www.jetbrains.net/confluence/display/TCD4/Extending+TeamCity
- javadoc: http://javadoc.jetbrains.net/teamcity/openapi/current/

To access build log you will need to find a build (SBuildServer.findBuildInstanceById(buildId)), get build log (SBuild.getBuildLog()) and then obtain messages iterator (BuildLogReader.getMessagesIterator())).

Keep in mind that build log messages are hierarchical.

0

Please sign in to leave a comment.