LogConfigurationExtensionsUseElasticSearchWithApiKey Method
使用 ElasticSearch 作為日誌目標 (ApiKey Authentication)
Namespace: eBizprise.Framework.Log.ElasticSearchAssembly: eBizprise.Framework.Log.LogHelper.ElasticSearch (in eBizprise.Framework.Log.LogHelper.ElasticSearch.dll) Version: 25.0.3.0+6e92afb880fa099fdfe407c9aa8d1b17eaaf3625
public static LogConfiguration UseElasticSearchWithApiKey(
this LogConfiguration logConfiguration,
string elasticSearchUri,
string apiKeyId,
string apiKey,
string indexFormat = "logs-${shortdate}",
LogLevel minLevel = null
)
- logConfiguration LogConfiguration
- 日誌配置物件
- elasticSearchUri String
- ElasticSearch 伺服器 URI
- apiKeyId String
- API Key ID
- apiKey String
- API Key
- indexFormat String (Optional)
- 索引名稱格式 (預設: logs-${shortdate})
- minLevel LogLevel (Optional)
- 最小日誌級別 (預設: Trace)
LogConfigurationLogConfiguration 物件 (支援鏈式呼叫)In Visual Basic and C#, you can call this method as an instance method on any object of type
LogConfiguration. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
LogHelper.Configure(config =>
{
config.UseElasticSearchWithApiKey(
"http://localhost:9200",
"VuaCfGcBCdbkQm-e5aOx",
"ui2lp2axTNmsyakw9tvNnw",
"myapp-logs-${shortdate}");
});
| Date | Version | Description |
|---|
| 2025/12/09 | 25.0.0.0 | 新增 ApiKey 驗證支援 |