UserReporter¶
This content has moved!
We have moved our samples to a separate, dedicated site: https://solutions.atlan.com.
This document is no longer being maintained.
Extracts details of all the user accounts configured within an Atlan instance, producing an Excel workbook consisting of 1 worksheet (named User Details
) with the following columns:
Column name | Usage |
---|---|
GUID | Unique identifier for the user. |
Username | Unique username for the user. |
First Name | First name of the user. |
Last Name | Last name of the user. |
Email address of the user. | |
Verified | When true , the user's email has been verified. |
Enabled | When true , the user is enabled and allowed to log in to Atlan. When false , the user will be prevented from logging in to Atlan. |
Role | User roles, including login roles and custom roles emerging from persona associations. |
Logins | Number of successful logins by the user account. |
Last Login | Timestamp of the last successful login for the user. |
Groups | Atlan Groups the user is part of. |
Personas | Personas the user is part of, directly and by virtue of group memberships. |
Configuration¶
You can configure the following options for this reporter as environment variables:
ATLAN_BASE_URL
¶
URL for your Atlan tenant (for example: https://tenant.atlan.com
).
ATLAN_API_KEY
¶
API token to use when accessing Atlan.
BATCH_SIZE
¶
Defines how many records the API calls attempt to retrieve on each request. (Defaults to 50
if not specified.)
FILE_PREFIX
¶
Defines what the Excel file's name will start with. (Defaults to user-details-report
if not specified.)
REGION
¶
Defines the AWS region of the S3 bucket where you want to write the Excel file output.
BUCKET
¶
Defines the S3 bucket where you want the reporter to store the Excel file output. (Note that there is no default value for this, so this must be sent for the utility to run via a Lambda function and produce consumable output — if blank (default) the reporter produces a local Excel file.)
Lambda configuration¶
To use this reporter as an AWS Lambda function, you can configure the same variables as above, but send them in a JSON structure:
{
"BATCH_SIZE": "50",
"FILE_PREFIX": "user-details-report",
"REGION": "ap-south-1",
"BUCKET": ""
}
Logging¶
By default, only messages at INFO
and above will be logged (to the console). You can change this level
by copying the main/resources/log4j2.xml
from the source repo and modifying it to give:
- more detail (
DEBUG
will log every API request and response, including their full payloads) - less detail (
WARN
will only print warnings and errors,ERROR
only errors).
Running the reporters locally¶
You can run the reporters locally on any machine with network access to your Atlan tenant.
When run in this mode, the reporter will read the input Excel file locally on the machine running the reporter. If you want to change any of the settings, you can simply prepend the command with the environment variables.
You can run the UserReporter
from a clone of the samples repository:
You will need a JDK installed to run this way, as the code must be compiled locally before it can be executed.
FILE_PREFIX=users \
./gradlew UserReporter # (1)!
-
Within the root directory of your local clone of the repo, run the Gradle task for the
UserReporter
.Overriding the configuration
Note that you can specify any optional overrides as environment variables before running the reporter. You can either do this in the same line where you run the command, or by exporting them first for example using
export FILE_PREFIX=users
.
You can run the UserReporter
by downloading the pre-compiled jar files for both:
With this approach you only need a JRE installed, as you will be using pre-compiled code.
FILE_PREFIX=users \
java \
-cp atlan-java-...-jar-with-dependencies.jar:atlan-java-samples-...-jar-with-dependencies.jar \
com.atlan.samples.reporters.UserReporter # (1)!
-
Within the directory containing the downloaded jar files, run the
java
command providing at least two arguments:- The two jar files, separated by a
:
. - The canonical classname of the
UserReporter
.
Overriding the configuration
Note that you can specify any optional overrides as environment variables before running the reporter. You can either do this in the same line where you run the command, or by exporting them first for example using
export FILE_PREFIX=users
.(Optional) If you want to override the logging settings, also add
-Dlog4j.configurationFile=./log4j2.xml
just before the canonical classname, pointing to your modified version of thelog4j2.xml
file.Replace the
...
with proper version numbersDon't forget to replace the
...
in the-cp
argument's values with proper version numbers, or running this will not work. - The two jar files, separated by a
10:37:46.821 [main] INFO com.atlan.samples.reporters.UserReporter - Retrieving user details for tenant: https://tenant.atlan.com
10:37:50.403 [main] INFO com.atlan.samples.reporters.UserReporter - Creating Excel file (in-memory)...
10:37:52.740 [main] INFO com.atlan.samples.reporters.UserReporter - Writing report to file: users-20230710-093746-818.xlsx
More details
- The final line will always tell you the name of the Excel file that it produced.