Skip to content

Instantly share code, notes, and snippets.

@dermanov-ru
Created May 27, 2019 14:45
Show Gist options
  • Save dermanov-ru/29991017ae9cd300e8909f2a8613bf16 to your computer and use it in GitHub Desktop.
Save dermanov-ru/29991017ae9cd300e8909f2a8613bf16 to your computer and use it in GitHub Desktop.
send_to_graylog.sh
# send any data to graylog server with http gelf protocol
# $1 - facility (info|warning|etc)
# $2 - application
# $3 - type
# $4 - short text (title)
# $5 - full text (body)
function send_to_graylog {
this_host="stage.np.ru"
graylog_http_gelf_host="IP:PORT"
msg='{"facility":"'$1'", "application":"'$2'", "type":"'$3'", "short_message":"'$4'", "full_message":"'$5'", "host":"'$this_host'"}'
#echo $msg
curl -XPOST http://$graylog_http_gelf_host/gelf -p0 -d "$msg"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment