配置文件:
input {
file {
path => "/home/wangshumin/ekl/logstash-5.3.1/data/input/testin1.txt"
start_position => "beginning"
}
}
filter { }
output {
file {
path =>"/home/wangshumin/ekl/logstash-5.3.1/data/input/testout1.txt"
codec => line { format => "custom format: %{message}"}
}
}
~
~
~
[wangshumin@CentOSNode2 logstash-5.3.1]$ bin/logstash -t myconfig/logstash.conf
Sending Logstash's logs to /home/wangshumin/ekl/logstash-5.3.1/logs which is now configured via log4j2.properties
ERROR: No configuration file was specified. Perhaps you forgot to provide the '-f yourlogstash.conf' flag?
usage:
bin/logstash -f CONFIG_PATH [-t] [-r] [] [-w COUNT] [-l LOG]
bin/logstash -e CONFIG_STR [-t] [--log.level fatal|error|warn|info|debug|trace] [-w COUNT] [-l LOG]
bin/logstash -i SHELL [--log.level fatal|error|warn|info|debug|trace]
bin/logstash -V [--log.level fatal|error|warn|info|debug|trace]
bin/logstash --help
[wangshumin@CentOSNode2 logstash-5.3.1]$ bin/logstash -f myconfig/logstash.conf
Sending Logstash's logs to /home/wangshumin/ekl/logstash-5.3.1/logs which is now configured via log4j2.properties[2018-01-29T13:35:43,683][INFO ][logstash.pipeline ] Starting pipeline {"id"=>"main", "pipeline.workers"=>1, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>125}
[2018-01-29T13:35:44,351][INFO ][logstash.pipeline ] Pipeline main started
[2018-01-29T13:35:44,510][INFO ][logstash.outputs.file ] Opening file {:path=>"/home/wangshumin/ekl/logstash-5.3.1/data/input/testout1.txt"}
[2018-01-29T13:35:44,514][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[wangshumin@CentOSNode2 input]$ ll
总用量 132
-rw-rw-r--. 1 wangshumin wangshumin 6184 1月 29 13:44 testin1.txt
-rw-rw-r--. 1 wangshumin wangshumin 115424 1月 29 13:44 testout1.txt
-rw-rw-r--. 1 wangshumin wangshumin 92 1月 29 13:45 生产数据的
-rw-rw-r--. 1 wangshumin wangshumin 57 1月 29 12:32 生产数据的shell
[wangshumin@CentOSNode2 input]$