Skip to content

Commit 87a8027

Browse files
committed
Add systemd-cat example
1 parent 928a24c commit 87a8027

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

examples/systemd-cat.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
log_level="info"
4+
if [ "$MESOS_LOG_STREAM" = "STDERR" ]; then
5+
log_level="err"
6+
fi
7+
8+
task_id=$(echo "$MESOS_EXECUTORINFO_JSON" | \
9+
jq -r '.command.environment.variables[]|select(.name=="MESOS_TASK_ID").value')
10+
11+
if [ "$task_id" ]; then
12+
task_identifier="-t $task_id"
13+
fi
14+
15+
systemd-cat $task_identifier -p $log_level

0 commit comments

Comments
 (0)