Sending data to Logstash over HTTP
At this point, sensors can start sending their readings to the Logstash data pipeline that we have created in the previous section. They just need to send data as follows:
curl -XPOST -u sensor_data:sensor_data --header "Content-Type: application/json" "http://localhost:8080/" -d '{"sensor_id":1,"time":1512102540000,"reading":16.24}'
Since we don't have real sensors, we will simulate the data by sending these types of requests. The simulated data and script that sends this data are incorporated in the code at https://github.com/pranav-shukla/learningelasticstack/tree/master/chapter-10/data.
If you are on Linux or macOS, open the terminal and change the directory to your Learning Elasticstack workspace that was checked out from GitHub.
Note
If your machine has a Windows operating system, you will need a Linux-like shell that supports the curl
command and basic BASH (Bourne Again SHell) commands. As you may already have a GitHub workspace checked out, you may...