Skip to content

Commit

Permalink
Merge pull request #4819 from osandamaleesha/master
Browse files Browse the repository at this point in the history
Add diagnostics logs guidelines to action execution
  • Loading branch information
himeshsiriwardana authored Oct 25, 2024
2 parents 8f2dc94 + 1238203 commit fd802c3
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 5 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion en/asgardeo/docs/guides/asgardeo-logs/diagnostic-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Diagnostic logs in Asgardeo are designed to help developers diagnose and trouble

## Access diagnostic logs

To access audit logs:
To access diagnostics logs:

1. On the Asgardeo Console, go to **Log**

Expand Down
116 changes: 112 additions & 4 deletions en/includes/guides/customize/actions/understanding-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ The following diagram illustrates the sequence of these steps:

### Responses {{product_name}} expects

Your service must handle the action by responding to the request from WSO2 Identity Server. The JSON payload of your response may include different action statuses and can contain an operations object to indicate state or flow changes. The specifics of these statuses and operations depend on the action type.
Your service must handle the action by responding to the request from {{product_name}}. The JSON payload of your response may include different action statuses and can contain an operations object to indicate state or flow changes. The specifics of these statuses and operations depend on the action type.

### Time out and retry

When WSO2 Identity Server calls an external service, it enforces a default read timeout of five seconds and a connection timeout of two seconds. WSO2 Identity Server will attempt at most one retry for the following HTTP status codes received from your service:
When {{product_name}} calls an external service, it enforces a default read timeout of five seconds and a connection timeout of two seconds. {{product_name}} will attempt at most one retry for the following HTTP status codes received from your service:

<table>
<thead>
Expand Down Expand Up @@ -182,7 +182,115 @@ Requests will not be retried if the external service responds with HTTP status c

### Troubleshooting

!!! note
Troubleshooting logs are not yet incorporated but are planned for inclusion by end October 2024.
You can use diagnostic logs to capture detailed information during the troubleshooting process. Logs capture requests sent from {{product_name}} to your external action service, track the responses received, and include status and context data for response handling.

Shown below is an example of a diagnostic log generated during the pre-issue access token action flow, while sending a request from {{product_name}} to the external endpoint.

{% if product_name == "WSO2 Identity Server" %}
```json
{
"logId": "582befe9-6114-4362-8fd4-05496e639fb8",
"recordedAt": {
"seconds": 1729488306,
"nanos": 479103000
},
"requestId": "d9b5f323-79cb-4a9e-9d84-f83ab7056122",
"resultStatus": "SUCCESS",
"resultMessage": "Call external service endpoint https://myextension.com for Pre Issue Access Token action.",
"actionId": "process-action-request",
"componentId": "action-execution",
"configurations": {
"action id": "0ab318c4-af38-4190-ae41-75f35ecdf7b6",
"action type": "Pre Issue Access Token",
"action endpoint": "https://myextension.com",
"action endpoint authentication type": "BASIC"
},
"logDetailLevel": "APPLICATION"
}
```
{%else %}

![Asgardeo logs]({{base_path}}/assets/img/guides/actions/action-diagnostics-logs-in-ui.png){: width="600" style="display: block; margin: 0; border: 0.3px solid lightgrey;"}

{%endif %}

The following table gives an explanation to each property included in the diagnostic log event.

<table>
<thead>
<tr class="header">
<th>Property</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>logId</td>
<td>
<p>Unique ID for each log event.</p>
</td>
</tr>
<tr class="even">
<td>recordedAt</td>
<td><p>Timestamp of log event occurrence.</p></td>
</tr>
<tr class="odd">
<td>requestId</td>
<td><p>Unique ID to correlate the log event to a specific request.</p></td>
</tr>
<tr class="even">
<td>resultStatus</td>
<td><p>Status of the log event. Either <code>Success</code> or <code>Failed</code>.</p></td>
</tr>
<tr class="odd">
<td>resultMessage</td>
<td><p>Description of the log event.</p></td>
</tr>
<tr class="even">
<td>actionId</td>
<td><p>ID to identify a specific log event.</p></td>
</tr>
<tr class="odd">
<td>componentId</td>
<td><p>ID to identify the component where the log event was carried out.</p></td>
</tr>
<tr class="even">
<td>configurations</td>
<td><p>System specific context data relevant to the log event.</p></td>
</tr>
<tr class="odd">
<td>input</td>
<td><p>Parameters given by the user which are applicable during the log event.</p></td>
</tr>
</tbody>
</table>

{% if product_name == "WSO2 Identity Server" %}

To enable diagnostic logs in system configurations, you may add the following configurations to the `deployment.toml` file located in the `<IS_HOME>/repository/conf` directory.

```toml
[server]
diagnostic_log_mode = "full"
```

!!!note
`[server]` is already defined in the `deployment.toml` file. So you just need to add the value.

Additionally, you may use system debug logs to capture similar context information mentioned above. You can enable it component wise by following the steps described [here.]({{base_path}}/deploy/monitor/monitor-logs/#enable-logs-for-a-component)

For an example, your configuration should look like below.

```
logger.org-wso2-carbon-identity-action-execution.name=org.wso2.carbon.identity.action.execution
logger.org-wso2-carbon-identity-action-execution.level=DEBUG
loggers = org-wso2-carbon-identity-action-execution
```

!!!note
It is highly recommended to disable both diagnostic logs and system debug logs once troubleshooting is completed as it may expose sensitive information included in responses and requests.

{%else %}
You may view the diagnostics logs under the logs tab in Asgardeo. [Refer here]({{base_path}}/guides/asgardeo-logs/diagnostic-logs/) to learn more about diagnostic logs in Asgardeo.
{%endif %}

0 comments on commit fd802c3

Please sign in to comment.