|
|
Posted on 2021-1-27 15:34:49
|
|
|
|

Logstash is a platform for the transmission, processing, management, and retrieval of application logs, events. You can use it to collect and manage application logs in a unified manner, and provide a web interface for querying and statistics.
Logstash simply means data:Input, filter, outputThe source and output of the data can be files, mq, tcp data, databases, es, etc.It doesn't have to be Elasticsearch(es)!
Download and install
First, the computer needs to install the Java environment (omitted)
C:\Users\itsvse_nuc>java -version java version "1.8.0_271" Java(TM) SE Runtime Environment (build 1.8.0_271-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)
The hyperlink login is visible.
Logstash download address:The hyperlink login is visible., taking Windows as an example, just download and unzip it.
Getting started tutorial
Logstash uses {} to define regions, which can include plugin region definitions, and you can define multiple plugins in one region. In the plug-in area, you can define key-value pair settings. Examples include:
The default logstash-sample.conf file looks like this:
# Sample Logstash configuration for creating a simple # Beats -> Logstash -> Elasticsearch pipeline.
input { beats { port => 5044 }
}
output { elasticsearch { hosts => ["http://localhost:9200"] index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY. MM.dd}" #user => "elastic" #password => "changeme" }
} Beats series software supports the Lumberjack protocol, and Logtail can use the Lumberjack protocolBeatsThe data collected by software (MetricBeat, PacketBeat, Winlogbeat, Auditbeat, Filebeat, Heartbeat, etc.) and Logstash are uploaded to the log service.
Read the log file
Synchronize all the contents of a file and listen to it
After listening, you cannot open, edit, and then save the file, you must use echo >> to add content to the file, you can see it
Read mysql
Use stdin as input and stdout as output
Run the following command under the program bin directory:
logstash end we automatically add several fields, timestamp @timestamp, version @version, type entered, and hostname host.
Listen for the UDP port as input
Under the program bin directory, create a new test.conf configuration file as follows:
Start the logstash program with a configuration file using the cmd command as follows:
Trying to send data over the UDP protocol, the C# code is as follows:
{"name":"architect","age":116,"result":{"url":"https://www.itsvse.com/"}} As shown below:
Modify the test.conf configuration file and try to write the data into Elasticsearch(es), as follows:
Kibana allows you to see that data has been successfully written to ES, as shown in the following image:
(End)
|
Previous:Upload, update, add, and delete files using SVNNext:CentOS counts each folder size and looks for large files
|