logstash学习记录

初步尝试

下载地址:
https://www.elastic.co/cn/downloads/logstash

wget https://artifacts.elastic.co/downloads/logstash/logstash-7.13.2-linux-x86_64.tar.gz
tar zxvf logstash-7.13.2-linux-x86_64.tar.gz
mv logstash-7.13.2 /usr/local/logstash

配置文件
/root/output_file_local.conf
内容:

input {
    file {
        path => "/root/test/*.log"
        start_position => "beginning"
    }
}
output {
    file {
        path => "/logstash/%{+yyyy}/%{+MM}/%{+dd}/%{host}.log"
        codec => line { format => "custom format: %{message}"}
    }
}

执行命令

nohup /usr/local/logstash/bin/logstash -f /root/output_file_local.conf >> /root/logstash.log 2>&1 &

将/root/test/*.log内容写入到/logstash/%{+yyyy}/%{+MM}/%{+dd}/%{host}.log

配置文件还有其他方式,暂时先记录这些,防止忘记

你可能感兴趣的:(基础知识,大数据)