Loki 3.4.3通过SAS推送日志至Azure Blob存储报错求正确配置
解决方案:Loki 3.4.3通过SAS令牌连接Azure Blob存储
问题原因
当前使用的连接字符串缺少AccountName字段,Loki的Azure存储客户端需要从连接字符串中解析出存储账户名,即使使用SAS令牌也必须包含该字段。
正确配置示例
修改storage_config.azure.connection_string,在连接字符串开头添加AccountName=<你的存储账户名>;,完整配置如下:
schema_config: configs: - from: "2020-12-11" index: period: 24h prefix: index_ object_store: azure schema: v13 store: tsdb storage_config: azure: container_name: lokicontainer request_timeout: 0 connection_string: AccountName=xxxxxx;BlobEndpoint=https://xxxxx.blob.core.windows.net/;QueueEndpoint=https://xxxxxx.queue.core.windows.net/;FileEndpoint=https://xxxxxx.file.core.windows.net/;TableEndpoint=https://xxxxxx.table.core.windows.net/;SharedAccessSignature=sv={SAS Value} tsdb_shipper: active_index_directory: /loki/index cache_location: /loki/index_cache cache_ttl: 24h filesystem: directory: /loki/chunks
关键说明
- 确保
AccountName的值与BlobEndpoint中的存储账户名一致(即xxxxx.blob.core.windows.net中的xxxxx) - SAS令牌需要具备容器级别的读写权限,确保Loki能正常上传日志块
- 不需要再配置
account_name和account_key字段,连接字符串会覆盖这些配置
内容的提问来源于stack exchange,提问作者tom bil
相关产品推荐
相关产品推荐

