remove log highlighting
Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
@@ -53,7 +53,6 @@ type Request struct {
|
|||||||
Sorts []Sort `json:"sort,omitempty"`
|
Sorts []Sort `json:"sort,omitempty"`
|
||||||
MainQuery BoolQuery `json:"query"`
|
MainQuery BoolQuery `json:"query"`
|
||||||
Aggs interface{} `json:"aggs,omitempty"`
|
Aggs interface{} `json:"aggs,omitempty"`
|
||||||
MainHighLight MainHighLight `json:"highlight,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Sort struct {
|
type Sort struct {
|
||||||
@@ -104,30 +103,6 @@ type RegexpQuery struct {
|
|||||||
Regexp interface{} `json:"regexp"`
|
Regexp interface{} `json:"regexp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MainHighLight struct {
|
|
||||||
Fields []interface{} `json:"fields,omitempty"`
|
|
||||||
FragmentSize int `json:"fragment_size"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogHighLightField struct {
|
|
||||||
FieldContent EmptyField `json:"log"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NamespaceHighLightField struct {
|
|
||||||
FieldContent EmptyField `json:"kubernetes.namespace_name.keyword"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PodHighLightField struct {
|
|
||||||
FieldContent EmptyField `json:"kubernetes.pod_name.keyword"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerHighLightField struct {
|
|
||||||
FieldContent EmptyField `json:"kubernetes.container_name.keyword"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type EmptyField struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
// StatisticsAggs, the struct for `aggs` of type Request, holds a cardinality aggregation for distinct container counting
|
// StatisticsAggs, the struct for `aggs` of type Request, holds a cardinality aggregation for distinct container counting
|
||||||
type StatisticsAggs struct {
|
type StatisticsAggs struct {
|
||||||
ContainerAgg ContainerAgg `json:"containers"`
|
ContainerAgg ContainerAgg `json:"containers"`
|
||||||
@@ -178,7 +153,6 @@ type Hits struct {
|
|||||||
|
|
||||||
type Hit struct {
|
type Hit struct {
|
||||||
Source Source `json:"_source"`
|
Source Source `json:"_source"`
|
||||||
HighLight HighLight `json:"highlight"`
|
|
||||||
Sort []int64 `json:"sort"`
|
Sort []int64 `json:"sort"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,13 +169,6 @@ type Kubernetes struct {
|
|||||||
Host string `json:"host"`
|
Host string `json:"host"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HighLight struct {
|
|
||||||
LogHighLights []string `json:"log,omitempty" description:"log messages to highlight"`
|
|
||||||
NamespaceHighLights []string `json:"kubernetes.namespace_name.keyword,omitempty" description:"namespaces to highlight"`
|
|
||||||
PodHighLights []string `json:"kubernetes.pod_name.keyword,omitempty" description:"pods to highlight"`
|
|
||||||
ContainerHighLights []string `json:"kubernetes.container_name.keyword,omitempty" description:"containers to highlight"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogRecord struct {
|
type LogRecord struct {
|
||||||
Time string `json:"time,omitempty" description:"log timestamp"`
|
Time string `json:"time,omitempty" description:"log timestamp"`
|
||||||
Log string `json:"log,omitempty" description:"log message"`
|
Log string `json:"log,omitempty" description:"log message"`
|
||||||
@@ -209,7 +176,6 @@ type LogRecord struct {
|
|||||||
Pod string `json:"pod,omitempty" description:"pod name"`
|
Pod string `json:"pod,omitempty" description:"pod name"`
|
||||||
Container string `json:"container,omitempty" description:"container name"`
|
Container string `json:"container,omitempty" description:"container name"`
|
||||||
Host string `json:"host,omitempty" description:"node id"`
|
Host string `json:"host,omitempty" description:"node id"`
|
||||||
HighLight HighLight `json:"highlight,omitempty" description:"highlighted log fragment"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadResult struct {
|
type ReadResult struct {
|
||||||
|
|||||||
@@ -209,14 +209,6 @@ func createQueryRequest(param v1alpha2.QueryParameters) ([]byte, error) {
|
|||||||
order = "desc"
|
order = "desc"
|
||||||
}
|
}
|
||||||
request.Sorts = append(request.Sorts, v1alpha2.Sort{Order: v1alpha2.Order{Order: order}})
|
request.Sorts = append(request.Sorts, v1alpha2.Sort{Order: v1alpha2.Order{Order: order}})
|
||||||
|
|
||||||
var mainHighLight v1alpha2.MainHighLight
|
|
||||||
mainHighLight.Fields = append(mainHighLight.Fields, v1alpha2.LogHighLightField{})
|
|
||||||
mainHighLight.Fields = append(mainHighLight.Fields, v1alpha2.NamespaceHighLightField{})
|
|
||||||
mainHighLight.Fields = append(mainHighLight.Fields, v1alpha2.PodHighLightField{})
|
|
||||||
mainHighLight.Fields = append(mainHighLight.Fields, v1alpha2.ContainerHighLightField{})
|
|
||||||
mainHighLight.FragmentSize = 0
|
|
||||||
request.MainHighLight = mainHighLight
|
|
||||||
}
|
}
|
||||||
|
|
||||||
request.MainQuery = v1alpha2.BoolQuery{Bool: mainBoolQuery}
|
request.MainQuery = v1alpha2.BoolQuery{Bool: mainBoolQuery}
|
||||||
@@ -303,7 +295,6 @@ func (c *ElasticSearchClient) parseQueryResult(operation int, body []byte) (*v1a
|
|||||||
logRecord.Pod = hit.Source.Kubernetes.Pod
|
logRecord.Pod = hit.Source.Kubernetes.Pod
|
||||||
logRecord.Container = hit.Source.Kubernetes.Container
|
logRecord.Container = hit.Source.Kubernetes.Container
|
||||||
logRecord.Host = hit.Source.Kubernetes.Host
|
logRecord.Host = hit.Source.Kubernetes.Host
|
||||||
logRecord.HighLight = hit.HighLight
|
|
||||||
readResult.Records = append(readResult.Records, logRecord)
|
readResult.Records = append(readResult.Records, logRecord)
|
||||||
}
|
}
|
||||||
queryResult.Read = &readResult
|
queryResult.Read = &readResult
|
||||||
|
|||||||
Reference in New Issue
Block a user