This is a sample of how to send some information to logstash via the TCP input in python. It assumes the logstash host is on "localhost" and the TCP listening input is 5959.
The logstash.conf should look something like the sample file.
The log message should be a stringified JSON object with the log message in the @message field.
To use, run the python script python sendMessageToLogstash.js