# which java
/opt/jdk-13.0.2/bin/java
# java --version
openjdk 13.0.2 2020-01-14
OpenJDK Runtime Environment (build 13.0.2+8)
OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
# wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
OK
# sudo apt-get install apt-transport-https
# echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
deb https://artifacts.elastic.co/packages/7.x/apt stable main
# sudo apt-get update && sudo apt-get install logstash
# wget https://artifacts.elastic.co/downloads/logstash/logstash-7.6.0.deb
# dpkg -i logstash-7.6.0.deb
vim /root/.bashrc
export PATH=$PATH:/usr/share/logstash/bin
# source /root/.bashrc
# logstash --version
logstash 7.6.0
# logstash -e 'input { stdin { } } output { stdout {} }'
The stdin plugin is now waiting for input:
[INFO ] 2020-03-02 14:19:04.379 [Agent thread] agent - Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[INFO ] 2020-03-02 14:19:04.583 [Api Webserver] agent - Successfully started Logstash API endpoint {:port=>9600}
hello world
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/awesome_print-1.7.0/lib/awesome_print/formatters/base_formatter.rb:31: warning: constant ::Fixnum is deprecated
{
"message" => "hello world",
"@timestamp" => 2020-03-02T06:20:04.979Z,
"@version" => "1",
"host" => "主机名"
}
参考: