Created
April 21, 2014 04:13
-
-
Save curzona/11132036 to your computer and use it in GitHub Desktop.
Send a message to logstash in python
This file contains hidden or 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
| input { | |
| udp { | |
| port => 5959 | |
| format => 'json' | |
| } | |
| } | |
| output { | |
| stdout { } | |
| elasticsearch { | |
| embedded => true | |
| } | |
| } |
This file contains hidden or 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
| import socket | |
| import json | |
| addr = ('127.0.0.1', 5959) | |
| msg = json.dumps({'title':"Bugs Bunny's Bustin' Out All Over", | |
| 'who':"Elmer Fudd", | |
| 'message':"It's wabbit season, and I'm hunting wabbits, so be vewy, vewy quiet!"}) | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| sock.sendto(msg, addr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment