Step 5: Log a message flow variable

In the previous step, you logged a static message that said "This is a test". A more realistic use case is logging the value of a message flow variable in an API proxy flow.

In this step, you'll log your client IP address, which is a property of the client flow variable.

To log your client IP address with your extension:

  1. In the API proxy editor, select the Develop tab.
  2. Click your extension logging policy and change the value of message:
    FROM:
    "message": "This is a test"
    TO:
    "message": "Client IP: {client.ip}"
  3. Save the proxy.
  4. Select the Trace tab.
  5. Click Start Trace Session, and click Send.
  6. Open the GCP console and go to Logging.
  7. Select the following:
    • Global
    • example-log
    • Last Hour

    You should see a log entry with your client IP address.

  8. To delete Stackdriver log entries and start fresh, see gcloud beta logging logs delete.

Next step

That's it! You're done for now. Go get a snack.

Discussion