Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 17:34:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 17:34:42 +0300
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /lib/gitlab/elasticsearch
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'lib/gitlab/elasticsearch')
-rw-r--r--lib/gitlab/elasticsearch/logs/lines.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/gitlab/elasticsearch/logs/lines.rb b/lib/gitlab/elasticsearch/logs/lines.rb
index fb32a6c9fcd..ff9185dd331 100644
--- a/lib/gitlab/elasticsearch/logs/lines.rb
+++ b/lib/gitlab/elasticsearch/logs/lines.rb
@@ -13,7 +13,7 @@ module Gitlab
@client = client
end
- def pod_logs(namespace, pod_name: nil, container_name: nil, search: nil, start_time: nil, end_time: nil, cursor: nil)
+ def pod_logs(namespace, pod_name: nil, container_name: nil, search: nil, start_time: nil, end_time: nil, cursor: nil, chart_above_v2: true)
query = { bool: { must: [] } }.tap do |q|
filter_pod_name(q, pod_name)
filter_namespace(q, namespace)
@@ -22,7 +22,7 @@ module Gitlab
filter_times(q, start_time, end_time)
end
- body = build_body(query, cursor)
+ body = build_body(query, cursor, chart_above_v2)
response = @client.search body: body
format_response(response)
@@ -30,13 +30,14 @@ module Gitlab
private
- def build_body(query, cursor = nil)
+ def build_body(query, cursor = nil, chart_above_v2 = true)
+ offset_field = chart_above_v2 ? "log.offset" : "offset"
body = {
query: query,
# reverse order so we can query N-most recent records
sort: [
{ "@timestamp": { order: :desc } },
- { "offset": { order: :desc } }
+ { "#{offset_field}": { order: :desc } }
],
# only return these fields in the response
_source: ["@timestamp", "message", "kubernetes.pod.name"],