+++ title = "Configuration" description = "Configuration Docs" keywords = ["grafana", "configuration", "documentation"] type = "docs" [menu.docs] name = "Configuration" identifier = "config" parent = "admin" weight = 1 +++
The Grafana back-end has a number of configuration options that can be
specified in a .ini configuration file or specified using environment variables.
Semicolons (the ; char) are the standard way to comment out lines in a .ini file.
A common problem is forgetting to uncomment a line in the custom.ini (or grafana.ini) file which causes the configuration option to be ignored.
$WORKING_DIR/conf/defaults.ini$WORKING_DIR/conf/custom.ini--config parameterNote. If you have installed Grafana using the
deborrpmpackages, then your configuration file is located at/etc/grafana/grafana.ini. This path is specified in the Grafana init.d script using--configfile parameter.
All options in the configuration file (listed below) can be overridden using environment variables using the syntax:
GF_<SectionName>_<KeyName>
Where the section name is the text within the brackets. Everything
should be upper case, . should be replaced by _. For example, given these configuration settings:
# default section
instance_name = ${HOSTNAME}
[security]
admin_user = admin
[auth.google]
client_secret = 0ldS3cretKey
Then you can override them using:
export GF_DEFAULT_INSTANCE_NAME=my-instance
export GF_SECURITY_ADMIN_USER=true
export GF_AUTH_GOOGLE_CLIENT_SECRET=newS3cretKey
Set the name of the grafana-server instance. Used in logging and internal metrics and in
clustering info. Defaults to: ${HOSTNAME}, which will be replaced with
environment variable HOSTNAME, if that is empty or does not exist Grafana will try to use
system calls to get the machine name.
Path to where Grafana stores the sqlite3 database (if used), file based sessions (if used), and other data. This path is usually specified via command line in the init.d script or the systemd service file.
How long temporary images in data directory should be kept. Defaults to: 24h. Supported modifiers: h (hours),
m (minutes), for example: 168h, 30m, 10h30m. Use 0 to never clean up temporary files.
Path to where Grafana will store logs. This path is usually specified via command line in the init.d script or the systemd service file. It can be overridden in the configuration file or in the default environment variable file.
Directory where grafana will automatically scan and look for plugins
Folder that contains provisioning config files that grafana will apply on startup. Dashboards will be reloaded when the json files changes
The IP address to bind to. If empty will bind to all interfaces
The port to bind to, defaults to 3000. To use port 80 you need to
either give the Grafana binary permission for example:
$ sudo setcap 'cap_net_bind_service=+ep' /usr/sbin/grafana-server
Or redirect port 80 to the Grafana port using:
$ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000
Another way is put a webserver like Nginx or Apache in front of Grafana and have them proxy requests to Grafana.
http or https
Note Grafana versions earlier than 3.0 are vulnerable to POODLE. So we strongly recommend to upgrade to 3.x or use a reverse proxy for ssl termination.
This setting is only used in as a part of the root_url setting (see below). Important if you
use GitHub or Google OAuth.
Redirect to correct domain if host header does not match domain. Prevents DNS rebinding attacks. Default is false.
This is the full URL used to access Grafana from a web browser. This is important if you use Google or GitHub OAuth authentication (for the callback URL to be correct).
Note This setting is also important if you have a reverse proxy in front of Grafana that exposes it through a subpath. In that case add the subpath to the end of this URL setting.
The path to the directory where the front end files (HTML, JS, and CSS
files). Default to public which is why the Grafana binary needs to be
executed with working directory set to the installation path.
Path to the certificate file (if protocol is set to https).
Path to the certificate key file (if protocol is set to https).
Set to true for Grafana to log all HTTP requests (not just errors). These are logged as Info level events to grafana log.
Grafana needs a database to store users and dashboards (and other
things). By default it is configured to use sqlite3 which is an
embedded database (included in the main Grafana binary).
Use either URL or or the other fields below to configure the database
Example: mysql://user:secret@host:port/database
Either mysql, postgres or sqlite3, it's your choice.
Only applicable for sqlite3 database. The file path where the database
will be stored.
Only applicable to MySQL or Postgres. Includes IP or hostname and port.
For example, for MySQL running on the same host as Grafana: host =
127.0.0.1:3306
The name of the Grafana database. Leave it set to grafana or some
other name.
The database user (not applicable for sqlite3).
The database user's password (not applicable for sqlite3). If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
For Postgres, use either disable, require or verify-full.
For MySQL, use either true, false, or skip-verify.
The path to the CA certificate to use. On many linux systems, certs can be found in /etc/ssl/certs.
The path to the client key. Only if server requires client authentication.
The path to the client cert. Only if server requires client authentication.
The common name field of the certificate used by the mysql or postgres server. Not necessary if ssl_mode is set to skip-verify.
The maximum number of connections in the idle connection pool.
The maximum number of open connections to the database.
Sets the maximum amount of time a connection may be reused. The default is 14400 (which means 14400 seconds or 4 hours). For MySQL, this setting should be shorter than the wait_timeout variable.
Set to true to log the sql calls and execution times.
The name of the default Grafana admin user (who has full permissions).
Defaults to admin.
The password of the default Grafana admin. Set once on first-run. Defaults to admin.
The number of days the keep me logged in / remember me cookie lasts.
Used for signing keep me logged in / remember me cookies.
Set to true to disable the use of Gravatar for user profile images.
Default is false.
Define a white list of allowed ips/domains to use in data sources. Format: ip_or_domain:port separated by spaces
Set to false to prohibit users from being able to sign up / create
user accounts. Defaults to false. The admin user can still create
users from the Grafana Admin Pages
Set to false to prohibit users from creating new organizations.
Defaults to false.
Set to true to automatically add new users to the main organization
(id 1). When set to false, new users will automatically cause a new
organization to be created for that new user.
Set this value to automatically add new users to the provided org.
This requires auto_assign_org to be set to true. Please make sure
that this organization does already exists.
The role new users will be assigned for the main organization (if the
above setting is set to true). Defaults to Viewer, other valid
options are Admin and Editor. e.g. :
auto_assign_org_role = Viewer
Viewers can edit/inspect dashboard settings in the browser. But not save the dashboard.
Defaults to false.
Set to true to disable (hide) the login form, useful if you use OAuth, defaults to false.
Set to true to disable the signout link in the side menu. useful if you use auth.proxy, defaults to false.
Set to true to enable anonymous access. Defaults to false
Set the organization name that should be used for anonymous users. If you change your organization name in the Grafana UI this setting needs to be updated to match the new name.
Specify role for anonymous users. Defaults to Viewer, other valid
options are Editor and Admin.
You need to create a GitHub OAuth application (you find this under the GitHub settings page). When you create the application you will need to specify a callback URL. Specify this as callback:
http://<my_grafana_server_name_or_ip>:<grafana_server_port>/login/github
This callback URL must match the full HTTP address that you use in your
browser to access Grafana, but with the prefix path of /login/github.
When the GitHub OAuth application is created you will get a Client ID and a
Client Secret. Specify these in the Grafana configuration file. For
example:
[auth.github]
enabled = true
allow_sign_up = true
client_id = YOUR_GITHUB_APP_CLIENT_ID
client_secret = YOUR_GITHUB_APP_CLIENT_SECRET
scopes = user:email,read:org
auth_url = https://github.com/login/oauth/authorize
token_url = https://github.com/login/oauth/access_token
api_url = https://api.github.com/user
team_ids =
allowed_organizations =
Restart the Grafana back-end. You should now see a GitHub login button on the login page. You can now login or sign up with your GitHub accounts.
You may allow users to sign-up via GitHub authentication by setting the
allow_sign_up option to true. When this option is set to true, any
user successfully authenticating via GitHub authentication will be
automatically signed up.
Require an active team membership for at least one of the given teams on GitHub. If the authenticated user isn't a member of at least one of the teams they will not be able to register or authenticate with your Grafana instance. For example:
[auth.github]
enabled = true
client_id = YOUR_GITHUB_APP_CLIENT_ID
client_secret = YOUR_GITHUB_APP_CLIENT_SECRET
scopes = user:email,read:org
team_ids = 150,300
auth_url = https://github.com/login/oauth/authorize
token_url = https://github.com/login/oauth/access_token
api_url = https://api.github.com/user
allow_sign_up = true
Require an active organization membership for at least one of the given organizations on GitHub. If the authenticated user isn't a member of at least one of the organizations they will not be able to register or authenticate with your Grafana instance. For example
[auth.github]
enabled = true
client_id = YOUR_GITHUB_APP_CLIENT_ID
client_secret = YOUR_GITHUB_APP_CLIENT_SECRET
scopes = user:email,read:org
auth_url = https://github.com/login/oauth/authorize
token_url = https://github.com/login/oauth/access_token
api_url = https://api.github.com/user
allow_sign_up = true
# space-delimited organization names
allowed_organizations = github google
First, you need to create a Google OAuth Client:
Go to https://console.developers.google.com/apis/credentials
Click the 'Create Credentials' button, then click 'OAuth Client ID' in the menu that drops down
Enter the following:
Replace https://grafana.mycompany.com with the URL of your Grafana instance.
Click Create
Copy the Client ID and Client Secret from the 'OAuth Client' modal
Specify the Client ID and Secret in the Grafana configuration file. For example:
[auth.google]
enabled = true
client_id = CLIENT_ID
client_secret = CLIENT_SECRET
scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
auth_url = https://accounts.google.com/o/oauth2/auth
token_url = https://accounts.google.com/o/oauth2/token
allowed_domains = mycompany.com mycompany.org
allow_sign_up = true
Restart the Grafana back-end. You should now see a Google login button
on the login page. You can now login or sign up with your Google
accounts. The allowed_domains option is optional, and domains were separated by space.
You may allow users to sign-up via Google authentication by setting the
allow_sign_up option to true. When this option is set to true, any
user successfully authenticating via Google authentication will be
automatically signed up.
This option could be used if have your own oauth service.
This callback URL must match the full HTTP address that you use in your
browser to access Grafana, but with the prefix path of /login/generic_oauth.
[auth.generic_oauth]
enabled = true
client_id = YOUR_APP_CLIENT_ID
client_secret = YOUR_APP_CLIENT_SECRET
scopes =
auth_url =
token_url =
api_url =
allowed_domains = mycompany.com mycompany.org
allow_sign_up = true
Set api_url to the resource that returns OpenID UserInfo compatible information.
First set up Grafana as an OpenId client "webapplication" in Okta. Then set the Base URIs to https://<grafana domain>/ and set the Login redirect URIs to https://<grafana domain>/login/generic_oauth.
Finally set up the generic oauth module like this:
[auth.generic_oauth]
name = Okta
enabled = true
scopes = openid profile email
client_id = <okta application Client ID>
client_secret = <okta application Client Secret>
auth_url = https://<okta domain>/oauth2/v1/authorize
token_url = https://<okta domain>/oauth2/v1/token
api_url = https://<okta domain>/oauth2/v1/userinfo
[auth.generic_oauth]
name = BitBucket
enabled = true
allow_sign_up = true
client_id = <client id>
client_secret = <client secret>
scopes = account email
auth_url = https://bitbucket.org/site/oauth2/authorize
token_url = https://bitbucket.org/site/oauth2/access_token
api_url = https://api.bitbucket.org/2.0/user
team_ids =
allowed_organizations =
Create a new Custom Connector with the following settings:
https://<grafana domain>/login/generic_oauthhttps://<grafana domain>/login/generic_oauththen:
Add an App to the Grafana Connector:
then:
Under the SSO tab on the Grafana App details page you'll find the Client ID and Client Secret.
Your OneLogin Domain will match the url you use to access OneLogin.
Configure Grafana as follows:
[auth.generic_oauth]
name = OneLogin
enabled = true
allow_sign_up = true
client_id = <client id>
client_secret = <client secret>
scopes = openid email name
auth_url = https://<onelogin domain>.onelogin.com/oidc/auth
token_url = https://<onelogin domain>.onelogin.com/oidc/token
api_url = https://<onelogin domain>.onelogin.com/oidc/me
team_ids =
allowed_organizations =
Type: Regular Web Application
Go to the Settings tab and set:
Allowed Callback URLs: https://<grafana domain>/login/generic_oauth
Click Save Changes, then use the values at the top of the page to configure Grafana:
[auth.generic_oauth]
enabled = true
allow_sign_up = true
team_ids =
allowed_organizations =
name = Auth0
client_id = <client id>
client_secret = <client secret>
scopes = openid profile email
auth_url = https://<domain>/authorize
token_url = https://<domain>/oauth/token
api_url = https://<domain>/userinfo
Log in to portal.azure.com and click "Azure Active Directory" in the side menu, then click the "Properties" sub-menu item.
Copy the "Directory ID", this is needed for setting URLs later
Click "App Registrations" and add a new application registration:
https://<grafana domain>/login/generic_oauthClick the name of the new application to open the application details page.
Note down the "Application ID", this will be the OAuth client id.
Click "Settings", then click "Keys" and add a new entry under Passwords
Click Save then copy the key value, this will be the OAuth client secret.
Configure Grafana as follows:
[auth.generic_oauth]
name = Azure AD
enabled = true
allow_sign_up = true
client_id = <application id>
client_secret = <key value>
scopes = openid email name
auth_url = https://login.microsoftonline.com/<directory id>/oauth2/authorize
token_url = https://login.microsoftonline.com/<directory id>/oauth2/token
api_url =
team_ids =
allowed_organizations =
When enabled is true (default) the http api will accept basic authentication.
Set to true to enable LDAP integration (default: false)
Path to the LDAP specific configuration file (default: /etc/grafana/ldap.toml)
Allow sign up should almost always be true (default) to allow new Grafana users to be created (if ldap authentication is ok). If set to false only pre-existing Grafana users will be able to login (if ldap authentication is ok).
For details on LDAP Configuration, go to the LDAP Integration page.
This feature allows you to handle authentication in a http reverse proxy.
Defaults to false
Defaults to X-WEBAUTH-USER
Defaults to username but can also be set to email
Set to true to enable auto sign up of users who do not exist in Grafana DB. Defaults to true.
Limit where auth proxy requests come from by configuring a list of IP addresses. This can be used to prevent users spoofing the X-WEBAUTH-USER header.
Used to define additional headers for Name, Email and/or Login, for example if the user's name is sent in the X-WEBAUTH-NAME header and their email address in the X-WEBAUTH-EMAIL header, set headers = Name:X-WEBAUTH-NAME Email:X-WEBAUTH-EMAIL.
Valid values are memory, file, mysql, postgres, memcache or redis. Default is file.
This option should be configured differently depending on what type of session provider you have configured.
data/sessionsuser:password@tcp(127.0.0.1:3306)/database_nameaddr=127.0.0.1:6379,pool_size=100,prefix=grafanaPostgres valid sslmode are disable, require, verify-ca, and verify-full (default).
The name of the Grafana session cookie.
Set to true if you host Grafana behind HTTPS only. Defaults to false.
How long sessions lasts in seconds. Defaults to 86400 (24 hours).
When enabled Grafana will send anonymous usage statistics to
stats.grafana.org. No IP addresses are being tracked, only simple counters to
track running instances, versions, dashboard & error counts. It is very helpful
to us, so please leave this enabled. Counters are sent every 24 hours. Default
value is true.
If you want to track Grafana usage via Google analytics specify your Universal Analytics ID here. By default this feature is disabled.
Number dashboard versions to keep (per dashboard). Default: 20, Minimum: 1.
This have been replaced with dashboards provisioning in 5.0+
true or false. Is disabled by default.
The full path to a directory containing your json dashboards.
Email server settings.
defaults to false
defaults to localhost:25
In case of SMTP auth, defaults to empty
In case of SMTP auth, defaults to empty
File path to a cert file, defaults to empty
File path to a key file, defaults to empty
Verify SSL for smtp server? defaults to false
Address used when sending out emails, defaults to admin@grafana.localhost
Name to be used when sending out emails, defaults to Grafana
Name to be used as client identity for EHLO in SMTP dialog, defaults to instance_name.
Either "console", "file", "syslog". Default is console and file Use space to separate multiple modes, e.g. "console file"
Either "debug", "info", "warn", "error", "critical", default is "info"
optional settings to set different levels for specific loggers.
Ex filters = sqlstore:debug
Enable metrics reporting. defaults true. Available via HTTP API /metrics.
Flush/Write interval when sending metrics to external TSDB. Defaults to 10s.
Include this section if you want to send internal Grafana metrics to Graphite.
Format <Hostname or ip>:port
Graphite metric prefix. Defaults to prod.grafana.%(instance_name)s.
Set to false to disable external snapshot publish endpoint (default true)
Set root url to a Grafana instance where you want to publish external snapshots (defaults to https://snapshots-origin.raintank.io)
Set name for external snapshot button. Defaults to Publish to snapshot.raintank.io
Enabled to automatically remove expired snapshots
These options control how images should be made public so they can be shared on services like slack.
You can choose between (s3, webdav, gcs, azure_blob, local). If left empty Grafana will ignore the upload action.
Bucket name for S3. e.g. grafana.snapshot
Region name for S3. e.g. 'us-east-1', 'cn-north-1', etc
Optional extra path inside bucket, useful to apply expiration policies
(for backward compatibility, only works when no bucket or region are configured) Bucket URL for S3. AWS region can be specified within URL or defaults to 'us-east-1', e.g.
Access key. e.g. AAAAAAAAAAAAAAAAAAAA
Access key requires permissions to the S3 bucket for the 's3:PutObject' and 's3:PutObjectAcl' actions.
Secret key. e.g. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Url to where Grafana will send PUT request with images
Optional parameter. Url to send to users in notifications, directly appended with the resulting uploaded file name.
basic auth username
basic auth password
Path to JSON key file associated with a Google service account to authenticate and authorize. Service Account keys can be created and downloaded from https://console.developers.google.com/permissions/serviceaccounts.
Service Account should have "Storage Object Writer" role.
Bucket Name on Google Cloud Storage.
Optional extra path inside bucket
Storage account name
Storage account key
Container name where to store "Blob" images with random names. Creating the blob container beforehand is required. Only public containers are supported.
Defaults to true. Set to false to disable alerting engine and hide Alerting from UI.
Makes it possible to turn off alert rule execution.