Create a logstash input based on http-plugin
This example shows the usage of logstash-http-input plugin. An external port can be used to write data to logstash which can be further visualized using kibana.
-
Install docker.
-
Install
docker-compose
sudo pip install docker-compose
-
In root-directory of this project run the following command. This will build the current elk image, install the
logstash-http-input
plugin, copy thehttp-input.conf
file in logstash's configurations.docker-compose up -d --build
The
http-input.conf
file contains some default configurations for e.g.Remaining configs can be found from here : sourcePort: 3332 user: myuser password: mypassword
-
In another terminal run
elastic_logger.py
to generate data.python elastic_logger.py
This following line in the code is used to post data on logstash-http-input.
requests.post( url='http://localhost:3332', data=json.dumps(payload), headers=self.headers, auth=('myuser', 'mypassword'))
-
Navigate to
http://localhost:5601
to see the kibana interface and click onDiscover
tab. The data from the topic would be there.