Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
KubeSphere
kubesphere
提交
11854e33
K
kubesphere
项目概览
KubeSphere
/
kubesphere
通知
138
Star
32
Fork
5
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kubesphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
11854e33
编写于
9月 29, 2019
作者:
H
huanggze
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
log: cleanup es client options
Signed-off-by:
N
huanggze
<
loganhuang@yunify.com
>
上级
d2b1bf4b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
37 deletion
+15
-37
pkg/server/config/config_test.go
pkg/server/config/config_test.go
+3
-6
pkg/simple/client/elasticsearch/esclient.go
pkg/simple/client/elasticsearch/esclient.go
+4
-6
pkg/simple/client/elasticsearch/options.go
pkg/simple/client/elasticsearch/options.go
+8
-25
未找到文件。
pkg/server/config/config_test.go
浏览文件 @
11854e33
...
...
@@ -91,12 +91,9 @@ func newTestConfig() *Config {
SecondaryEndpoint
:
"http://prometheus.kubesphere-monitoring-system.svc"
,
},
LoggingOptions
:
&
esclient
.
ElasticSearchOptions
{
Host
:
"http://elasticsearch-logging.kubesphere-logging-system.svc:9200"
,
LogstashFormat
:
false
,
Index
:
""
,
LogstashPrefix
:
"elk"
,
Match
:
"kube.*"
,
Version
:
"6"
,
Host
:
"http://elasticsearch-logging.kubesphere-logging-system.svc:9200"
,
IndexPrefix
:
"elk"
,
Version
:
"6"
,
},
KubeSphereOptions
:
&
kubesphere
.
KubeSphereOptions
{
APIServer
:
"http://ks-apiserver.kubesphere-system.svc"
,
...
...
pkg/simple/client/elasticsearch/esclient.go
浏览文件 @
11854e33
...
...
@@ -73,12 +73,10 @@ func NewLoggingClient(options *ElasticSearchOptions) (*ElasticSearchClient, erro
version
=
options
.
Version
}
if
options
.
LogstashFormat
{
if
options
.
LogstashPrefix
!=
""
{
index
=
options
.
LogstashPrefix
}
else
{
index
=
"logstash"
}
if
options
.
IndexPrefix
!=
""
{
index
=
options
.
IndexPrefix
}
else
{
index
=
"logstash"
}
switch
version
{
...
...
pkg/simple/client/elasticsearch/options.go
浏览文件 @
11854e33
...
...
@@ -6,22 +6,16 @@ import (
)
type
ElasticSearchOptions
struct
{
Host
string
`json:"host" yaml:"host"`
LogstashFormat
bool
`json:"logstashFormat" yaml:"logstashFormat"`
Index
string
`json:"index" yaml:"index"`
LogstashPrefix
string
`json:"logstashPrefix,omitempty" yaml:"logstashPrefix"`
Match
string
`json:"match" yaml:"match"`
Version
string
`json:"version" yaml:"version"`
Host
string
`json:"host" yaml:"host"`
IndexPrefix
string
`json:"indexPrefix,omitempty" yaml:"indexPrefix"`
Version
string
`json:"version" yaml:"version"`
}
func
NewElasticSearchOptions
()
*
ElasticSearchOptions
{
return
&
ElasticSearchOptions
{
Host
:
""
,
LogstashFormat
:
false
,
Index
:
"fluentbit"
,
LogstashPrefix
:
""
,
Match
:
"kube.*"
,
Version
:
""
,
Host
:
""
,
IndexPrefix
:
"fluentbit"
,
Version
:
""
,
}
}
...
...
@@ -43,19 +37,8 @@ func (s *ElasticSearchOptions) AddFlags(fs *pflag.FlagSet) {
"if this filed left blank, KubeSphere will use kubernetes builtin log API instead, and"
+
" the following elastic search options will be ignored."
)
fs
.
BoolVar
(
&
s
.
LogstashFormat
,
"logstash-format"
,
s
.
LogstashFormat
,
""
+
"Whether to toggle logstash format compatibility."
)
fs
.
StringVar
(
&
s
.
LogstashPrefix
,
"logstash-prefix"
,
s
.
LogstashPrefix
,
""
+
"If logstash-format is enabled, the Index name is composed using a prefix and the date,"
+
"e.g: If logstash-prefix is equals to 'mydata' your index will become 'mydata-YYYY.MM.DD'."
+
"The last string appended belongs to the date when the data is being generated."
)
fs
.
StringVar
(
&
s
.
Match
,
"elasticsearch-match"
,
s
.
Match
,
""
+
"The regex match for index, eg. kube.*"
)
fs
.
StringVar
(
&
s
.
Index
,
"elasticsearch-index"
,
s
.
Index
,
""
+
"Index name."
)
fs
.
StringVar
(
&
s
.
IndexPrefix
,
"index-prefix"
,
s
.
IndexPrefix
,
""
+
"Index name prefix. KubeSphere will retrieve logs against indices matching the prefix."
)
fs
.
StringVar
(
&
s
.
Version
,
"elasticsearch-version"
,
s
.
Version
,
""
+
"ElasticSearch major version, e.g. 5/6/7, if left blank, will detect automatically."
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录