#!/bin/bash -e

if [ -z "$LOGSTASH_HOST" ]; then
	echo "LOGSTASH_HOST is unset"
	exit 2	
fi

cp journalbeat.yml.tmpl journalbeat.yml
cat << EOF >> journalbeat.yml
output:
  logstash:
    hosts: ["${LOGSTASH_HOST}"]
EOF

./journalbeat -e -v

#!/bin/bash -e

cp journalctl.yml.tmpl journalctl.yml
cat << EOF >> journalctl.yml
output:
  logstash:
    hosts: ["${LOGSTASH_HOST}"]
EOF

./journalbeat -e -v

--- 
+++ 
@@ -1,7 +1,12 @@
 #!/bin/bash -e
 
-cp journalctl.yml.tmpl journalctl.yml
-cat << EOF >> journalctl.yml
+if [ -z "$LOGSTASH_HOST" ]; then
+	echo "LOGSTASH_HOST is unset"
+	exit 2	
+fi
+
+cp journalbeat.yml.tmpl journalbeat.yml
+cat << EOF >> journalbeat.yml
 output:
   logstash:
     hosts: ["${LOGSTASH_HOST}"]
Check for LOGSTASH_HOST; use correct filename
