Skip to content

Instantly share code, notes, and snippets.

@rsff
Created March 19, 2015 12:55
Show Gist options
  • Save rsff/4203b764adb409945257 to your computer and use it in GitHub Desktop.
Save rsff/4203b764adb409945257 to your computer and use it in GitHub Desktop.
send data to graylog testing GELF
import json
import urllib2
import socket
graydata = json.loads(open('/tmp/json.out').read())
val = graydata['general']
val["short_message"] = socket.gethostname()+ " access statistics"+" from "+val["log_file"]
val["host"] = socket.gethostname()
json_data = json.dumps(val)
urllib2.urlopen("http://url.pt:1943/gelf", json_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment