File tree 4 files changed +58
-8
lines changed
.github/workflows/scripts
4 files changed +58
-8
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ endgroup
35
35
# AND event.dataset:"system.cpu"
36
36
# AND metricset.name:"cpu"
37
37
#
38
- log ' Searching a document generated by Fleet Server'
38
+ log ' Searching a system document generated by Fleet Server'
39
39
40
40
declare response
41
41
declare -i count
@@ -70,3 +70,44 @@ if (( count == 0 )); then
70
70
echo ' Expected at least 1 document'
71
71
exit 1
72
72
fi
73
+
74
+ # We expect to find log entries for the 'elasticsearch' Compose service using
75
+ # the following query:
76
+ #
77
+ # agent.name:"fleet-server"
78
+ # AND agent.type:"filebeat"
79
+ # AND container.name:"docker-elk-elasticsearch-1"
80
+ #
81
+ log ' Searching a container document generated by Fleet Server'
82
+
83
+ response=
84
+ count=0
85
+
86
+ was_retried=0
87
+
88
+ # retry for max 60s (30*2s)
89
+ for _ in $( seq 1 30) ; do
90
+ response=" $( curl " http://${ip_es} :9200/logs-docker.container_logs-default/_search?q=agent.name:%22fleet-server%22%20AND%20agent.type:%22filebeat%22%20AND%20container.name:%22docker-elk-elasticsearch-1%22&pretty" -s -u elastic:testpasswd) "
91
+
92
+ set +u # prevent "unbound variable" if assigned value is not an integer
93
+ count=" $( jq -rn --argjson data " ${response} " ' $data.hits.total.value' ) "
94
+ set -u
95
+
96
+ if (( count > 0 )) ; then
97
+ break
98
+ fi
99
+
100
+ was_retried=1
101
+ echo -n ' x' >&2
102
+ sleep 2
103
+ done
104
+ if (( was_retried)) ; then
105
+ # flush stderr, important in non-interactive environments (CI)
106
+ echo >&2
107
+ fi
108
+
109
+ echo " $response "
110
+ if (( count == 0 )) ; then
111
+ echo ' Expected at least 1 document'
112
+ exit 1
113
+ fi
Original file line number Diff line number Diff line change @@ -37,11 +37,6 @@ management UI: [Fleet UI Settings][fleet-cfg].
37
37
38
38
## Known Issues
39
39
40
- - Logs and metrics are only collected within the Fleet Server's container. Ultimately, we want to emulate the behaviour
41
- of the existing Metricsbeat and Filebeat extensions, and collect logs and metrics from all ELK containers
42
- out-of-the-box. Unfortunately, this kind of use-case isn't (yet) well supported by Fleet, and most advanced
43
- configurations currently require running Elastic Agents in [ standalone mode] [ fleet-standalone ] .
44
- (Relevant resource: [ Migrate from Beats to Elastic Agent] [ fleet-beats ] )
45
40
- The Elastic Agent auto-enrolls using the ` elastic ` super-user. With this approach, you do not need to generate a
46
41
service token — either using the Fleet management UI or [ CLI utility] [ es-svc-token ] — prior to starting this
47
42
extension. However convenient that is, this approach _ does not follow security best practices_ , and we recommend
@@ -64,6 +59,4 @@ management UI: [Fleet UI Settings][fleet-cfg].
64
59
65
60
[ config-kbn ] : ../../kibana/config/kibana.yml
66
61
67
- [ fleet-standalone ] : https://www.elastic.co/guide/en/fleet/current/elastic-agent-configuration.html
68
- [ fleet-beats ] : https://www.elastic.co/guide/en/fleet/current/migrate-beats-to-agent.html
69
62
[ es-svc-token ] : https://www.elastic.co/guide/en/elasticsearch/reference/current/service-tokens-command.html
Original file line number Diff line number Diff line change @@ -6,8 +6,19 @@ services:
6
6
context : extensions/fleet/
7
7
args :
8
8
ELASTIC_VERSION : ${ELASTIC_VERSION}
9
+ # Run as 'root' instead of 'elastic-agent' (uid 1000) to allow reading
10
+ # 'docker.sock' and the host's filesystem.
11
+ user : root
9
12
volumes :
10
13
- fleet-server:/usr/share/elastic-agent/state:Z
14
+ - type : bind
15
+ source : /var/lib/docker/containers
16
+ target : /var/lib/docker/containers
17
+ read_only : true
18
+ - type : bind
19
+ source : /var/run/docker.sock
20
+ target : /var/run/docker.sock
21
+ read_only : true
11
22
environment :
12
23
FLEET_SERVER_ENABLE : ' 1'
13
24
FLEET_SERVER_INSECURE_HTTP : ' 1'
Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ xpack.fleet.packages:
47
47
version : latest
48
48
- name : elastic_agent
49
49
version : latest
50
+ - name : docker
51
+ version : latest
50
52
- name : apm
51
53
version : latest
52
54
@@ -67,6 +69,9 @@ xpack.fleet.agentPolicies:
67
69
- name : elastic_agent-1
68
70
package :
69
71
name : elastic_agent
72
+ - name : docker-1
73
+ package :
74
+ name : docker
70
75
- name : Agent Policy APM Server
71
76
id : agent-policy-apm-server
72
77
description : Static agent policy for the APM Server integration
You can’t perform that action at this time.
0 commit comments