[paths]部分data指定Grafana存储临时文件、会话和SQLite数据库如果使用的路径例如data /var/lib/grafana。temp_data_lifetime设置data目录中临时文件的过期时间超过该时间的文件将被删除如temp_data_lifetime 24h表示24小时。logs定义Grafana存储日志的目录如logs /var/log/grafana。plugins指定Grafana自动扫描和查找插件的目录如plugins /var/lib/grafana/plugins。provisioning设置包含配置文件的文件夹路径Grafana在启动和运行时将应用这些配置如provisioning conf/provisioning。[server]部分protocol定义Grafana使用的协议如http、https、h2或socket如protocol http。min_tls_version指定允许的最低TLS版本如min_tls_version TLS1.2。http_addr绑定的IP地址空值表示绑定到所有接口如http_addr 。http_port使用的HTTP端口如http_port 3000。domain用于从浏览器访问Grafana的公共域名如domain localhost。enforce_domain如果主机头与域名不匹配是否重定向到正确的域名防止DNS重绑定攻击如enforce_domain false。root_url在浏览器中使用的完整公共URL用于重定向和电子邮件如root_url %(protocol)s://%(domain)s:%(http_port)s/。serve_from_sub_path是否从root_url设置中指定的子路径提供Grafana服务如serve_from_sub_path false。router_logging是否记录Web请求如router_logging false。static_root_path相对工作路径如static_root_path public。enable_gzip是否启用gzip压缩如enable_gzip false。cert_file和cert_key用于HTTPS的证书和密钥文件路径如cert_file 和cert_key 。cert_pass解密密钥文件的可选密码如cert_pass 。certs_watch_interval证书文件的监视间隔如certs_watch_interval 。socket_gidUnix套接字的组ID如socket_gid 。socket_modeUnix套接字的模式如socket_mode 。socketUnix套接字路径如socket 。cdn_urlCDN URL如cdn_url 。read_timeout设置读取传入请求的超时时间如read_timeout 0表示无超时。[database]部分type选择数据库类型如sqlite3、mysql或postgres如type sqlite3。host、name、user和password分别是数据库服务器主机地址、数据库名称、用户名和密码用于配置数据库连接如host 127.0.0.1:3306、name grafana、user root、password 。url使用URL配置数据库连接的替代方式如url mysql://user:secrethost:port/database。max_idle_conn最大空闲连接数默认值为2如max_idle_conn 2。max_open_conn最大打开连接数默认值为0未设置如max_open_conn 。conn_max_lifetime连接的最大生存时间默认14400秒4小时如conn_max_lifetime 14400。log_queries是否记录SQL调用和执行时间如log_queries 。ssl_mode对于postgres使用disable、require或verifyfull对于mysql使用true、false或skipverify如ssl_mode disable。ssl_sni对于postgres设置为1启用或0禁用SNI如ssl_sni 。isolation_level数据库驱动支持的事务隔离级别如isolation_level 。ca_cert_path、client_key_path和client_cert_path与SSL/TLS相关的证书路径如ca_cert_path 、client_key_path 、client_cert_path 。server_cert_name服务器证书名称如server_cert_name 。path仅适用于sqlite3相对于data_path设置的数据库文件路径如path grafana.db。cache_mode仅适用于sqlite3数据库连接的缓存模式如cache_mode private。wal仅适用于sqlite3启用/禁用预写日志如wal false。migration_locking仅适用于mysql和postgres在迁移时是否锁定数据库默认值为true如migration_locking true。locking_attempt_timeout_sec仅适用于mysql和postgres迁移时锁定数据库失败前的等待时间默认值为0如locking_attempt_timeout_sec 0。query_retries仅适用于sqlite数据库锁定失败时查询的重试次数默认值为0禁用如query_retries 0。transaction_retries仅适用于sqlite数据库锁定失败时事务的重试次数默认值为5如transaction_retries 5。instrument_queries是否为数据库查询添加指标和跟踪如instrument_queries false。[security]部分disable_initial_admin_creation是否在Grafana首次启动时禁用创建管理员用户如disable_initial_admin_creation false。admin_user和admin_password默认管理员用户和密码如admin_user admin、admin_password admin。admin_email默认管理员电子邮件如admin_email adminlocalhost。secret_key用于签名的密钥如secret_key SW2YcwTIb9zpOOhoPsMm。encryption_provider当前用于信封加密的密钥提供程序默认值为secretKey.v1如encryption_provider secretKey.v1。available_encryption_providers配置的密钥提供程序列表如available_encryption_providers 。disable_gravatar是否禁用Gravatar个人资料图片如disable_gravatar false。data_source_proxy_whitelist数据源代理白名单如data_source_proxy_whitelist 。disable_brute_force_login_protection是否禁用暴力登录保护如disable_brute_force_login_protection false。cookie_secure如果在HTTPS后面托管Grafana是否设置为true默认值为false如cookie_secure false。cookie_samesite设置Cookie的SameSite属性如cookie_samesite lax。allow_embedding是否允许浏览器在frame、iframe、embed或object中渲染Grafana默认值为false如allow_embedding false。strict_transport_security是否启用HTTP严格传输安全HSTS响应头如strict_transport_security false。strict_transport_security_max_age_seconds设置浏览器应缓存HSTS的时间仅在strict_transport_security启用时应用如strict_transport_security_max_age_seconds 86400。strict_transport_security_preload是否启用HSTS预加载选项仅在strict_transport_security启用时应用如strict_transport_security_preload false。strict_transport_security_subdomains是否启用HSTS的includeSubDomains选项仅在strict_transport_security启用时应用如strict_transport_security_subdomains false。x_content_type_options是否启用X Content Type Options响应头如x_content_type_options true。x_xss_protection是否启用X XSS Protection头如x_xss_protection true。content_security_policy是否启用添加Content Security Policy头如content_security_policy false。content_security_policy_template设置Content Security Policy头的模板如content_security_policy_template scriptsrcselfunsafeevalunsafeinlinestrictdynamic $NONCE;objectsrc none;fontsrcself;stylesrcselfunsafeinline blob:;imgsrc * data:;baseuriself;connectsrcself grafana.com ws://$ROOT_PATH wss://$ROOT_PATH;manifestsrcself;mediasrc none;formactionself;。content_security_policy_report_only是否启用添加Content Security Policy Report Only头如content_security_policy_report_only false。content_security_policy_report_only_template设置Content Security Policy Report Only头的模板如content_security_policy_report_only_template scriptsrcselfunsafeevalunsafeinlinestrictdynamic $NONCE;objectsrc none;fontsrcself;stylesrcselfunsafeinline blob:;imgsrc * data:;baseuriself;connectsrcself grafana.com ws://$ROOT_PATH wss://$ROOT_PATH;manifestsrcself;mediasrc none;formactionself;。angular_support_enabled是否支持旧的Angular插件如angular_support_enabled false。csrf_trusted_originsCSRF检查信任的额外URL列表如csrf_trusted_origins example.com。csrf_additional_headers用户可以设置的允许的额外头部列表如csrf_additional_headers 。csrf_always_check即使请求没有登录Cookie是否执行CSRF检查如csrf_always_check false。disable_frontend_sandbox_for_plugins逗号分隔的插件ID列表这些插件将不在前端沙箱中加载如disable_frontend_sandbox_for_plugins 。actions_allow_post_urlPOST/PUT URL操作的允许路径列表空值表示允许任何不在同一源的内容如actions_allow_post_url 。[auth]部分login_cookie_name登录Cookie的名称如login_cookie_name grafana_session。disable_login是否禁用Grafana内置的登录解决方案如disable_login false。login_maximum_inactive_lifetime_duration经过多长时间无活动后用户需要重新登录默认值为7天如login_maximum_inactive_lifetime_duration 。login_maximum_lifetime_duration用户登录后多长时间需要重新登录默认值为30天如login_maximum_lifetime_duration 。token_rotation_interval_minutes认证用户活动时令牌应多久轮换一次默认值为10分钟如token_rotation_interval_minutes 10。disable_login_form是否隐藏登录表单在使用OAuth时有用默认值为false如disable_login_form false。disable_signout_menu是否禁用侧边菜单中的注销链接在使用auth.proxy或auth.jwt时有用默认值为false如disable_signout_menu false。signout_redirect_url注销后重定向的URL如signout_redirect_url 。oauth_auto_login是否自动尝试使用OAuth登录跳过登录屏幕如oauth_auto_login false。oauth_login_error_message设置自定义的OAuth错误消息如oauth_login_error_message oauth.login.error。oauth_state_cookie_max_ageOAuth状态Cookie的最大年龄秒默认值为600秒如oauth_state_cookie_max_age 600。oauth_refresh_token_server_lock_min_wait_ms服务器锁重试机制的最小等待时间毫秒用于防止多个Grafana实例同时刷新OAuth令牌如oauth_refresh_token_server_lock_min_wait_ms 1000。api_key_max_seconds_to_liveAPI密钥的最大生存时间秒1表示无限制如api_key_max_seconds_to_live 1。sigv4_auth_enabled是否启用基于HTTP的数据源的SigV4身份验证选项如sigv4_auth_enabled false。sigv4_verbose_logging是否启用SigV4请求签名的详细日志记录如sigv4_verbose_logging false。azure_auth_enabled是否启用基于HTTP的数据源的Azure身份验证选项如azure_auth_enabled false。oauth_allow_insecure_email_lookup是否使用电子邮件查找以及IdP提供的唯一ID如oauth_allow_insecure_email_lookup false。id_response_header_enabled是否在响应头中包含身份ID如id_response_header_enabled false。id_response_header_prefix身份响应头的前缀如id_response_header_prefix X Grafana。id_response_header_namespaces要添加身份响应头的命名空间列表如id_response_header_namespaces user api key service account。managed_service_accounts_enabled是否启用托管服务账户用于插件身份验证当前仅支持单组织部署如managed_service_accounts_enabled false。### [auth.anonymous]部分enabled是否启用匿名访问如enabled false。org_name指定匿名用户使用的组织名称如org_name Main Org.。org_role指定匿名用户的角色如org_role Viewer。hide_version是否对匿名用户隐藏Grafana版本号如hide_version false。device_limit设备数量限制如device_limit 。[auth.github]、[auth.gitlab]这些部分用于配置不同的认证提供程序如GitHub、GitLab、Google等。以下是一些常见字段的含义name认证提供程序的名称如name GitHub。icon在登录界面显示的图标如icon github。enabled是否启用该认证提供程序如enabled false。allow_sign_up是否允许通过该认证提供程序进行注册如allow_sign_up true。auto_login是否自动登录如auto_login false。client_id和client_secret与认证提供程序相关的客户端ID和客户端密钥如client_id some_id、client_secret some_secret。scopes请求的权限范围如scopes user:email,read:org。auth_url、token_url和api_url认证、获取令牌和获取用户信息的URL如auth_url https://github.com/login/oauth/authorize、token_url https://github.com/login/oauth/access_token、api_url https://api.github.com/user。signout_redirect_url注销后的重定向URL如signout_redirect_url 。allowed_domains允许的域名列表如allowed_domains 。team_ids和allowed_groups允许的团队ID和组用于限制访问如team_ids 、allowed_groups 。role_attribute_path和role_attribute_strict用于确定用户角色的属性路径和是否严格匹配如role_attribute_path 、role_attribute_strict false。org_mapping组织映射用于将外部组织与Grafana组织关联如org_mapping 。allow_assign_grafana_admin是否允许分配Grafana管理员角色如allow_assign_grafana_admin false。skip_org_role_sync是否跳过组织角色同步如skip_org_role_sync false。tls_skip_verify_insecure是否