|
1 | 1 | # python-django-audit-logs-example
|
2 | 2 |
|
3 |
| -An example Django application demonstrating how to use the [WorkOS Python SDK](https://github.com/workos/workos-python) to send and retrieve Audit Log events. This example is not meant to show a real-world example of an Audit Logs implementation, but rather to show concrete examples of how events can be sent using the Python SDK. |
| 3 | +An example Django application demonstrating how to use the [WorkOS Python SDK](https://github.com/workos/workos-python) to send and retrieve Audit Log events. |
4 | 4 |
|
5 | 5 | ## Prerequisites
|
6 | 6 |
|
@@ -112,25 +112,22 @@ Starting development server at http://127.0.0.1:8000/
|
112 | 112 | Quit the server with CONTROL-C.
|
113 | 113 | ```
|
114 | 114 |
|
115 |
| -Navigate to `localhost:8000` in your web browser. You should see a place to enter your organization ID. This can be found in the WorkOS Dashboard for the Organization you'd like to send logs to. |
| 115 | +Navigate to `localhost:8000` in your web browser. You will see a list of your organizations. Click one to get started. |
116 | 116 |
|
117 | 117 | You can stop the local Django server for now by entering `CTRL + c` on the command line.
|
118 | 118 |
|
119 | 119 | ### Audit Logs Setup with WorkOS
|
120 | 120 |
|
121 |
| -11. Follow the [Audit Logs configuration steps](https://workos.com/docs/audit-logs/emit-an-audit-log-event/sign-in-to-your-workos-dashboard-account-and-configure-audit-log-event-schemas) to set up the following 5 events that are sent with this example: |
| 121 | +11. Follow the [Audit Logs configuration steps](https://workos.com/docs/audit-logs/emit-an-audit-log-event/sign-in-to-your-workos-dashboard-account-and-configure-audit-log-event-schemas) to set up the following 2 events that are sent with this example: |
122 | 122 |
|
123 |
| -Action title: "user.signed_in" | Target type: "team" |
124 |
| -Action title: "user.logged_out" | Target type: "team" |
125 | 123 | Action title: "user.organization_set" | Target type: "team"
|
126 | 124 | Action title: "user.organization_deleted" | Target type: "team"
|
127 |
| -Action title: "user.connection_deleted" | Target type: "team" |
128 | 125 |
|
129 |
| -12. Next, take note of the Organization ID for the Org which you will be sending the Audit Log events for. This ID gets entered into the splash page of the example application. |
| 126 | +12. Configure the Admin Portal Redirect URI. |
130 | 127 |
|
131 |
| -13. Once you enter the Organization ID and submit it, you will be brought to the page where you'll be able to send the audit log events that were just configured. You'll also notice that the action of setting the Organization triggered an Audit Log already. Click the buttons to send the respective events. |
| 128 | +Navigate to the Configuration tab in your WorkOS Dshboard. From there click the Admin Portal tab. Click the Edit Admin Portal Redirect Links button and add "http://localhost:8000" to the "When clicking the back navigation, return users to:" input, then click Save Redirect Links. |
132 | 129 |
|
133 |
| -14. To obtain a CSV of the Audit Log events that were sent for the last 30 days, click the "Export Events" button. This will bring you to a new page where you can download the events. Downloading the events is a 2 step process. First you need to create the report by clicking the "Generate CSV" button. Then click the "Access CSV" button to download a CSV of the Audit Log events for the selected Organization for the past 30 days. |
| 130 | +13. To obtain a CSV of the Audit Log events that were sent for the last 30 days, click the "Export Events" tab. This will bring you to a new page where you can download the events. Downloading the events is a 2 step process. First you need to create the report by clicking the "Generate CSV" button. Then click the "Access CSV" button to download a CSV of the Audit Log events for the selected Organization for the past 30 days. You may also adjust the time range using the form inputs. |
134 | 131 |
|
135 | 132 | ## Need help?
|
136 | 133 |
|
|
0 commit comments