Skip to content

Instantly share code, notes, and snippets.

@idlethreat
Last active December 19, 2017 01:32
Show Gist options
  • Save idlethreat/2ec5961b0d904a9d6c16425881eca49e to your computer and use it in GitHub Desktop.
Save idlethreat/2ec5961b0d904a9d6c16425881eca49e to your computer and use it in GitHub Desktop.
Graylog Message Sender
#!/bin/bash
# set your sleep in seconds. remove the sleep line to have no sleep
SLEEP="1"
# ip of your graylog server
GRAYLOG="192.168.1.1"
# loripsum.net API URL
LORIPSUM="https://loripsum.net/api/1/long/plaintext"
while :
do
MESSAGE=$(curl -s $LORIPSUM)
echo '{"version": "1.1","host":"example.org","short_message":"A short message that helps you identify what is going on","full_message":"'$MESSAGE'","level":1,"_user_id":9001,"_some_info":"foo","_some_env_var":"bar"}' | gzip | nc -u -w 1 $GRAYLOG 12201
sleep $SLEEP # comment this out if you want to sleep
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment