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

Logstash

Logstash is a data pipeline that can take data input from various sources, filter it, and output it to various sources; these sources can be files, Kafka, or databases. Logstash is a very important tool in Elastic Stack as it's primarily used to pull data from various sources and push it to Elasticsearch; from there, Kibana can use that data for analysis or visualization. We can take any type of data using Logstash, such as structured or unstructured data , which comes from various sources, such as the internet. The data can be transformed using Logstash's filter option, which has different plugins to play with different sets of data. For example, if we get an IP address in our data, the GeoIP plugin can add geolocation using that IP address, and in the output, we can get additional information of geolocation, which can then be used in Kibana to plot a map.

The following expression shows us an example of a Logstash configuration file:

input 
{
file
{
path => "/var/log/apache2/access.log"
}
}
filter
{
grok
{
match => {message => "%{COMBINEDAPACHELOG}"}
}
}
output
{
elasticsearch
{
hosts => "localhost"
}
}

In the preceding expression, we have three sections: input, filter, and output. In the input section, we're reading the Apache access log file data. The filter section is there to extract Apache access log data in different fields, using the grok filter option. The output section is quite straightforward as it's pushing the data to the local Elasticsearch cluster. We can configure the input and output sections to read or write from or to different sources, whereas we can apply different plugins to transform the input data; for example, we can mutate a field, transform a field value, or add geolocation from an IP address using the filter option.


Grok is a tool that we can use to generate structured and queryable data by parsing unstructured data.
主站蜘蛛池模板: 罗平县| 大英县| 巴彦县| 凌云县| 嘉祥县| 平谷区| 新乐市| 当涂县| 平山县| 买车| 元谋县| 灵璧县| 柘荣县| 大竹县| 彩票| 辉南县| 丹巴县| 平谷区| 兴隆县| 临夏市| 泗水县| 普定县| 万年县| 广丰县| 苏尼特右旗| 宾川县| 旌德县| 土默特右旗| 汤阴县| 永寿县| 尉氏县| 凌云县| 沂水县| 怀远县| 福贡县| 广平县| 辛集市| 乌审旗| 呼玛县| 泸溪县| 阿巴嘎旗|