Environment CentOS System
- Docker pulls the image Logstash
7.6.2
Docker pull logstash: 7.6.2Copy the code
-
Create the/myData /logstash directory and copy the logstash configuration file logstash
We’ll use it later to mount files in the Logstash container
Store the logstash-codec-json_lines plug-in that we installed offline
mkdir /mydata/logstash
#Stores files related to offline plug-in installation
mkdir /mydata/logstash/offlinePlugin
Copy the code
-
Downloading offline plug-ins
Github plugin download address
Search for the logstash-codec-json_lines plug-in and download the latest version of the tar.gz file
Uploading/mydata logstash/OfflinePlugin, use the command decompression
The tar - ZXVF logstash codec - json_lines - 3.0.6. Tar. GzCopy the code
-
Run the following command to start the Logstash service
docker run --name logstash -p 4560:4560 -p 4561:4561 -p 4562:4562 -p 4563:4563 \ -v /mydata/logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf \ -v / mydata/logstash/offlinePlugin: / usr/share/logstash/offlinePlugin \ - d logstash: 7.6.2Copy the code
-
– v/mydata/logstash/offlinePlugin: / usr/share/logstash offlinePlugin command to mount the local directory with the container
-
Go inside the container and install the jSON_lines plug-in
#Inside the Logstash container
docker exec -it logstash /bin/bash
cd
#Check the file
ls
Copy the code
You can view our offlinePlugin folder
vi /usr/share/logstash/Gemfile
Copy the code
-
Specify the address of our offline plug-in
Gem “logstash-codec-json_lines” changed to gem “logstash-codec-json_lines” : the path = > “/ usr/share/logstash/offlinePlugin/logstash – codec – json_lines – 3.0.6”
-
Change the IP address to a domestic mirror address
Change the default rubygems.org to gems.ruby-china.com
-
Save the exit
- Executing installation Commands
logstash-plugin install --no-verify
Copy the code
ok ,enjoy it
.!