elk

kibana圖形展現

x軸爲metrics,如account,max,min等
y軸爲聚合條件,如按時間顯示,按地區顯示,按host顯示等等

filter插件設置

能夠定義語句與正則表達式匹配
filter {
                if [source] == "/var/log/httpd/access_log" {
                                grok {
                                                match => { "message" => "%{COMBINEDAPACHELOG}" }
                                }
                }
                else if [source] == "/var/log/messages" {
                                grok {
                                                match => { "message" => "%{SYSLOGBASE2}"}
                                                match => { "message" => "%{SYSLOGPAMSESSION}"}
                                }
                }
}

%{COMBINEDAPACHELOG}是已經定義好的正則表達式,能夠在官網中查詢應用所須要的正則表達式,也能夠本身定義
可是使用正則表達式將會大大佔用CPU資源正則表達式

logstash中定義index

能夠使用命令直接定義elasticsearch

input {
    udp {
        ...
        type => "foo"
    }
    file {
        ...
        type => "bar"
    }
}

output {
    if [type] == "foo" {
        elasticsearch {
            ...
            index => "foo-index"
        }
    } else {
        elasticsearch {
            ...
            index => "bar-index"
        }
    }
}
相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息