logstash 学习

一、命令行学习

logstash -h 显示帮助文档

logstash -V 显示版本

logstash -e 调试

logstash -f 加载指定配置文件或目录

二、加入filter 调试

input {
    stdin { }
}
filter {
        grok {
            match=>{ "message"=>"%{IPV4:remote_addr} %{HOSTNAME:domain_name} %{USERNAME:remote_user} %{USERNAME:http_tracker_id} \[%{HTTPDATE:request_time}\] \"%{URIPROTO:request_method} %{URIPATHPARAM:request_path} HTTP\/%{BASE16FLOAT:http_version}\" %{INT:response_status} (%{BASE16FLOAT:response_time}|-) (%{NUMBER:response_bytes}|-) (%{NUMBER:request_length}|-) \"%{GREEDYDATA:http_refferer}\" \"%{GREEDYDATA:user_agent}\" \"%{GREEDYDATA:upstream_add}\" \"%{GREEDYDATA:upstream_connect_time}\" \"%{GREEDYDATA:upstream_header_time}\" \"%{GREEDYDATA:upstream_response_time}\" \"%{GREEDYDATA:upstream_status}\" \"%{GREEDYDATA:x_forward_for}\""}
            }
        date {
            match => [ "request_time" , "dd/MMM/YYYY:HH:mm:ss Z" ]
        }
        mutate {
            add_field =>{
                "short_message" => "%{[message]}"
            }
        }
}
output {
    stdout { 
        codec => rubydebug 
    }
}
# logstash -f logstash.conf

你可能感兴趣的:(logstash)