Table: grafana_user - Query Grafana Users using SQL
Grafana is a multi-platform open-source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources. Users in Grafana represent accounts with login credentials that can be granted permissions to access resources within Grafana.
Table Usage Guide
The grafana_user
table provides insights into user accounts within Grafana. As an administrator or security analyst, explore user-specific details through this table, including their roles, permissions, and associated metadata. Utilize it to manage user access control, review user permissions, and ensure adherence to security policies.
Important Notes
- The API used by this table requires admin user access via basic authentication (i.e.
admin:password
) in theauth
config field. Reference.
Examples
List all users
Explore all the users within your Grafana platform to manage access and permissions effectively. This helps to maintain security and control over who can access and modify your data.
select *from grafana_user;
select *from grafana_user;
List all admin users
Identify instances where users have administrative privileges. This can be useful for ensuring proper access controls and identifying potential security risks.
select login, email, is_adminfrom grafana_userwhere is_admin;
select login, email, is_adminfrom grafana_userwhere is_admin = 1;
Users who have not been seen for more than 30 days
Discover the segments of users who have not logged in for over a month. This can be useful to identify inactive users and potentially reach out to them to re-engage them with the platform.
select login, email, last_seen_at, last_seen_at_agefrom grafana_userwhere last_seen_at < current_timestamp - interval '30 days';
select login, email, last_seen_at, last_seen_at_agefrom grafana_userwhere last_seen_at < datetime('now', '-30 days');
Users created in the last 7 days
Explore which Grafana users were created in the past week. This is useful to keep track of new user activity and growth within your system.
select login, email, created_atfrom grafana_userwhere created_at > current_timestamp - interval '7 days';
select login, email, created_atfrom grafana_userwhere created_at > datetime('now', '-7 days');
Schema for grafana_user
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
auth_labels | jsonb | Auth labels for the user, e.g. OAuth. | |
avatar_url | text | URL of the avatar for the user. | |
created_at | timestamp with time zone | Time when the user was created. | |
text | = | Email of the user. | |
id | bigint | = | Unique identifier for the user. |
is_admin | boolean | True if the user is an administrator. | |
is_disabled | boolean | True if the user has been disabled. | |
is_external | boolean | True if the user is external to the system. | |
last_seen_at | timestamp with time zone | Last time the user logged in. | |
last_seen_at_age | text | Display string for when the user last logged in, e.g. 2m. | |
login | text | Login name of the user. | |
name | text | Name of the user. | |
org_id | bigint | Org the user is a member of. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
theme | text | UI theme preferred by the user. | |
updated_at | timestamp with time zone | Last time the user was updated. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- grafana
You can pass the configuration to the command with the --config
argument:
steampipe_export_grafana --config '<your_config>' grafana_user