4 Replies Latest reply on Jan 16, 2019 3:43 PM by Jeeraud Maloon

    How to Invoke WildFly Rest Endpoint to Obtain Logging File Content

    Jeeraud Maloon Newbie

      To obtain a portion of JBoss/WildFly (v. 14) log file using CLI programmatically, I can execute the following command to obtain the last 10 lines of the server.log file:








      I cannot use the CLI command as the JBoss CLI Client jar file is not approved, and not included on the server to begin with. Hence the need to make HTTP/Rest calls.


      According to the HTTP Management API page, I should get the content following this pattern:




      These are the supported operations for a GET :

      • attribute : for a read-attribute operation
      • resource : for a read-resource operation
      • resource-description : for a read-resource-description operation
      • snapshots : for the list-snapshots operation
      • operation-description : for a read-operation-description operation
      • operation-names : for a read-operation-names operation


      For simple attributes like server status, I am able to retrieve data from both the browser and programmatically (e.g. http://localhost:9990/management?operation=attribute&name=server-state&json.pretty=1).


      However, I have tried many variations to no avail, e.g.


      I get a list of operations including "read-log-file" (appears to be similar to executing the following CLI command "/subsystem=logging: [TAB]" which lists everything the following Rest operation provides):



      Get list of nodes with the followings (when connected to CLI and execute "/subsystem=logging/ [TAB]" minus several of commands -- not sure if the Rest API is limited):





      Get Management resource not found



      Get a blank page



      Can somebody please provide a Rest call for WildFly v. 14 to achieve this objective? Thanks.