This article is a mirror article of machine translation, please click here to jump to the original article.

View: 13052|Reply: 1

Get started with Logstash, an open-source log management tool

[Copy link]
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.

Centos 7 installation and deployment elasticsearch-6.5.2 tutorial
https://www.itsvse.com/thread-6173-1-1.html

Install the elasticsearch-6.5.2 elasticsearch-head plugin
https://www.itsvse.com/thread-6190-1-1.html

Tutorial on installing elasticsearch-analysis-ik in elasticsearch-6.5.2
https://www.itsvse.com/thread-6191-1-1.html

Centos 7 installation and deployment elasticsearch-6.5.2 tutorial
https://www.itsvse.com/thread-6173-1-1.html

Install the elasticsearch-6.5.2 elasticsearch-head plugin
https://www.itsvse.com/thread-6190-1-1.html

Tutorial on installing elasticsearch-analysis-ik in elasticsearch-6.5.2
https://www.itsvse.com/thread-6191-1-1.html


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:

.net/c# UDP communication gadget [source code]
https://www.itsvse.com/thread-3538-1-1.html
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 SVN
Next:CentOS counts each folder size and looks for large files
 Landlord| Posted on 2021-5-7 14:26:57 |
Introduction to the Logstash API interface
https://www.itsvse.com/thread-9638-1-1.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com