Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add diagnostics logs guidelines to action execution #4819

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
112 changes: 110 additions & 2 deletions en/includes/guides/customize/actions/understanding-actions.md
Original file line number Diff line number Diff line change
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. Log captures requests sent from the Identity Server to your external action service, track the responses received, and include status and context data for response handling.

Below is an example of a diagnostic log generated during the pre-issue access token action flow, while sending the request initiated in the identity server 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 ‘Success’ or ‘Failed’.</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 %}