File tree 1 file changed +41
-0
lines changed
1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # This creates a config file for Filebeat in the sandbox directory
3
+ # and starts Filebeat, reading from standard input.
4
+
5
+ # We use the logstash output by default, which Graylog supports
6
+ # through the Beats input.
7
+ OUTPUT_HOSTS=' ["your.graylog.example.com:5044"]'
8
+
9
+ config_path=" $MESOS_LOG_SANDBOX_DIRECTORY /filebeat-$MESOS_LOG_STREAM .yml"
10
+
11
+ mesos_fields=$( echo " $MESOS_EXECUTORINFO_JSON " | \
12
+ jq -r " .command.environment.variables
13
+ |map(\" \(.name):\(.value|tostring)\" )|.[]" | \
14
+ # Skip empty variables, use mesos_ prefix, convert to lowercase
15
+ awk -F: ' length($2) > 0 {
16
+ $1=tolower($1);
17
+ if (!match($1, "^mesos_.*")) {
18
+ $1="mesos_" $1;
19
+ }
20
+ printf("%s: \"%s\"\n ", $1, $2);
21
+ }' )
22
+
23
+ cat << EOF > $config_path
24
+ filebeat:
25
+ prospectors:
26
+ -
27
+ paths:
28
+ - "-"
29
+ input_type: stdin
30
+ close_eof: true
31
+ fields:
32
+ mesos_log_stream: $MESOS_LOG_STREAM
33
+ mesos_log_sandbox_directory: $MESOS_LOG_SANDBOX_DIRECTORY
34
+ $mesos_fields
35
+
36
+ output:
37
+ logstash:
38
+ hosts: $OUTPUT_HOSTS
39
+ EOF
40
+
41
+ /usr/bin/filebeat -c $config_path
You can’t perform that action at this time.
0 commit comments