官术网_书友最值得收藏!

Outputting the log data into Elasticsearch

The next step is going to be to execute the configuration so that Logstash can start reading logs from the Apache log file. In order to execute the Logstash configuration file, we need to run the following command:

bin/logstash -f /etc/logstash/conf.d/logs-apache.conf

The following screen is showing us the result after executing the preceding command. Once the command is executed successfully, we will get a message, such as Successfully started Logstash API endpoint {:port=>9600}:

When we execute the Logstash configuration, it connects to the output source, which in this case is Elasticsearch. This starts the pipeline so that it reads the data from the log file and puts it into Elasticsearch.

To test this setup, we need to open the browser so that we can open some localhost websites that are served through the Apache server, as this will provide some data for writing to the Apache log file. To test whether the logs have been pushed to Elasticsearch, we can open the Elasticsearch index and check the logs:

http://localhost:9200/logs_apache/_search?pretty

In the preceding screenshot, we can see that Logstash is reading the Apache logs and pushing them to the Elasticsearch server.

主站蜘蛛池模板: 莎车县| 汝州市| 双鸭山市| 瓮安县| 祥云县| 乌什县| 饶阳县| 方山县| 涿州市| 永兴县| 潜山县| 广宗县| 屏山县| 夏津县| 葫芦岛市| 叶城县| 宜春市| 怀柔区| 大渡口区| 文成县| 六枝特区| 乌鲁木齐市| 潍坊市| 读书| 乐山市| 延吉市| 南丹县| 嘉义县| 瑞丽市| 化州市| 永胜县| 武安市| 定州市| 绍兴县| 丰都县| 宝兴县| 南部县| 崇义县| 弋阳县| 嵩明县| 新密市|