Created
May 27, 2019 14:45
-
-
Save dermanov-ru/29991017ae9cd300e8909f2a8613bf16 to your computer and use it in GitHub Desktop.
send_to_graylog.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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