View the Log using WebSocket

Log Socket uses WebSocket which is an application protocol that provides simultaneous two-way communication between a client and a server over a single TCP connection. The WebSocket protocol enables the client and the server to send data independently.

The following formats are used to represent a WebSocket endpoint:

wss://host:port/path?query

For more information about the WebSocket Protocol, see RFC 6455.

View the Live Log

This section guides you on how to access live logs by establishing a WebSocket connection through Postman. Here, Postman is used as an example, the steps outlined here can be customized for other WebSocket compatible tools.

To view the live log, create a WebSocket request from the sidebar in Postman using the following steps:

  1. Select New > WebSocket to open a raw WebSocket request in a new tab.

  2. Generate a new Access Token using GET HTTPS request and copy the Access Token. For more information on how to generate a new access token, refer to Authentication.

  3. Now, on WebSocket request, under Header, in Authorization field, type Bearer, then press enter, and paste the access token.

  4. Generate a query token by sending the following HTTPS request.

    HTTP Method

    GET

    Base URL

    https://<environment-host>/<app-deployment-name>/logging/api/logs/status

    Content-Type

    application/json

    Authorization

    Oauth 2.0 access token

  5. The above request returns a token.

  6. Copy the token. Now, enter the WebSocket server URL as per the following format and add the token to the query:

    Base URL: wss://<environment-host>/<app-deployment-name>/logging/api/logs/tail?<token that is generated through status API>

  7. Click Connect. The application has been connected, and live logs are displayed in the message pane.

  8. To disconnect your WebSocket request connection, select Disconnect.

View WebSocket Messages

Users can use Postman Message pane to view the list of received messages for the WebSocket connection.