J Fabian Meier
J Fabian Meier

Reputation: 35805

Read Nexus 2.x logs using REST

Is it possible to read the Nexus 2.14 log (the one you see in Administration -> Logging) per http access (REST)?

If not, are there other means to read it from an external program?

Upvotes: 0

Views: 190

Answers (2)

Raktim Biswas
Raktim Biswas

Reputation: 4077

There's an option to download the logs from the Log tab in Nexus.

Nexus - Download logs]

Once you have downloaded the file, your browser will capture the URL from where it was downloaded, which will be listed in the downloads section of your browser.

Download URL

You can use the below methods to fetch the logs,

  • Fetching the logs using curl:

    curl -u uname:pass http://nexusURL/nexus/service/siesta/logging/log
    
  • Fetching the logs in Node.js using the request module:

    var request = require('request')
    
    var opts = {
        headers: { Authorization: "Basic YWRtaW46YWRtaW4=" },   //For admin:admin
        uri: 'http://nexusURL/nexus/service/siesta/logging/log',
        method: "GET"
    }
    request(opts,function(err, res, body){
            console.log(body)
        }
    );
    

Upvotes: 0

J Fabian Meier
J Fabian Meier

Reputation: 35805

It seems that

http://localhost:8081/nexus/service/siesta/logging/log

gives you the recent log file (found by trial and error).

Upvotes: 0

Related Questions