Service:
Log Searching, Stats and Data visualization as a Service.
Team:
凌霄( @craftsman凌霄 )
高英举( @Gary的影响力 )
规模:每天32亿条日志,2TB
Long Long Ago:
In the Future:
see more: http://logstash.net/
Kibana 3
Kibana 4
Indexer
Shipper
Indexer
Buffer
1. wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.0.noarch.rpm
2. rpm -ivh elasticsearch-1.7.0.noarch.rpm
3. service elasticsearch start
4. curl -X GET http://localhost:9200/
1. cd to your web server's ( e.g. nginx) www root
2. wget https://download.elasticsearch.org/kibana/kibana/kibana-3.1.0.tar.gz -O kibana-3.1.0.tar.gz
3. tar zxvf kibana-3.1.0.tar.gz
4.configure elasticsearch host in config.js
5. open your web browser with url http://your_server/kibana-3.1.0
1. wget https://download.elastic.co/logstash/logstash/logstash-1.5.3.tar.gz
2. tar zxvf logstash-1.5.3.tar.gz
3. cd logstash-1.5.3 && bin/logstash agent -f logstash_test.conf
# logstash_test.conf : a simple configuration example of logstash
input {
stdin {}
}
filter {
grok {
match => [ "message", "%{NUMBER:http_status} %{WORD:method}" ]
}
if [ http_status ] =~ /^[4-5]\d\d/ {
drop {}
}
}
output {
stdout { codec => rubydebug }
}
Getting Started More Quickly and Easily Using Docker
see:
http://dspgit.cluster.sina.com.cn/dip_elk/elk_user_docs/blob/master/tutorials/setup_elk_using_sce.md
Why US ( DIP ELK ) ?
input { ... }
filter {
if [ip] {
geoip2 {
source => "ip"
target => "#ip"
}
}
if [ua] {
# <device_type>__weibo__<weibo_version>__<os_type>_<os_version>
# iPhone7,1__weibo__5.1.3__iphone__os8.1.3
# iPad3,4__weibo__4.5.0__iphone__os7.0.4
# Xiaomi-MI 2A__weibo__4.3.0__android__android4.1.1
# samsung-GT-N7100__weibo__4.3.5__android__android4.3
# OPPO-R850__weibo__4.3.0__android__android4.2.2
grok {
match => ["ua", "%{DATA:agent_device_type}__weibo__%{DATA:agent_weibo_version}__%{DATA:agent_os_type}__%{DATA:agent_os_version}$"]
}
}
}
output {
elasticsearch {
index => "weibo-client-video-%{+YYYY.MM.dd}"
host => [ "1002.es.dip.sina.com.cn:9200" ]
protocol => "http"
workers => 2
flush_size => 20000
}
}
我们面临的易用性难题:
如何增强易用性:
新浪IP库+ logstash-filter-geoip2
用户日志接入自动化+Es Index管理自动化
官方Kibana 3 -> 官方Kibana 4
现状:
方案:
我们遇到的困难:
start ip ~ end ip 如何转换成 net/mask的形式
1.4.5.1 ~ 1.4.5.255 TO 1.4.5.0/24
1.4.5.1 ~ 1.4.7.255 TO 1,4.5.0/24, 1.4.6.0/24
1.4.0000 0101.1
1.4.0000 0111.255
start ip ~ end ip 如何转换成 net/mask的形式:
Binary bit -> BTree:
http://dspgit.cluster.sina.com.cn/dip_elk/maxminddb_geoip2/blob/master/iprange2networks.py
start ip ~ end ip 如何转换成 net/mask的形式
59.43.44.148 ~ 59.43.45.107 ?中国 北京 电信
59.43.44.148/30,
59.43.44.152/29,
59.43.44.160/27,
59.43.44.192/26,
59.43.45.0/26,
59.43.45.64/27,
59.43.45.96/29,
59.43.45.104/30
我们的成果:
Open Source
logstash-filter-geoip2已开源并与logstash官方插件logstash-filter-geoip合并。现在是logstash-5.0.0 builtin plugin。
官方博文:Logstash Lines: GeoIP filter enhancements
https://www.elastic.co/blog/logstash-lines-2016-05-02
Es standard analyzer中文分词:
”美国打伊拉克“—>"美",”国“,”打“,”伊“,”拉“,”克“
ik analyzer 中文分词:
”美国打伊拉克“—>”美国“,”打“,”伊拉克“
1.http://www.elasticsearch.org
2.http://logstash.net
3.https://speakerdeck.com/elasticsearch/scale-12x-introduction-to-elasticsearch-logstash-and-kibana
4.http://garyelephant.me/article/details/23750563
5.https://speakerdeck.com/elastic/whats-cookin-in-kibana-4
6.http://www.docker.com