试试搜索一下吧

logstash获取Hbase日志,并检索错误日志

Logstash | 作者 eternal | 发布于2018年11月27日 | 阅读数:3097

input {
file {
path => "/var/log/hbase/hbase-cmf-hbase-REGIONSERVER-cm.xxx.com.log.out"
start_position => beginning
}
}

output {
stdout {}
}

目前的话是能读取日志输出到控制台,但是现在不太会写过滤条件,希望有一个例子
2018-11-12 19:58:09,964 INFO org.apache.hadoop.hbase.regionserver.wal.FSHLog: Archiving hdfs://cm.macro.com:8020/hbase/WALs/cm.macro.com,60020,1541991478324/cm.macro.com%2C60020%2C1541991478324.null0.1542020287946 to hdfs://cm.macro.com:8020/hbase/oldWALs/cm.macro.com%2C60020%2C1541991478324.null0.1542020287946
2018-11-12 19:58:55,405 INFO SecurityLogger.org.apache.hadoop.hbase.Server: Auth successful for hbase (auth:SIMPLE)
2018-11-12 19:58:55,405 INFO SecurityLogger.org.apache.hadoop.hbase.Server: Connection from 192.168.1.121 port: 40630 with version info: version: "1.2.0-cdh5.13.1" url: "file:///data/jenkins/workspace/generic-package-centos64-7-0/topdir/BUILD/hbase-1.2.0-cdh5.13.1" revision: "Unknown" user: "jenkins" date: "Thu Nov 9 08:47:05 PST 2017" src_checksum: "662aa851e2a5eb467173c7b6f9479905"
2018-11-12 19:58:59,330 INFO org.apache.hadoop.hbase.regionserver.wal.FSHLog: Rolled WAL /hbase/WALs/cm.macro.com,60020,1541991478324/cm.macro.com%2C60020%2C1541991478324.meta.1542020334864.meta with entries=0, filesize=91 B; new WAL /hbase/WALs/cm.macro.com,60020,1541991478324/cm.macro.com%2C60020%2C1541991478324.meta.1542023939311.meta
2018-11-12 19:58:59,330 INFO org.apache.hadoop.hbase.regionserver.wal.FSHLog: Archiving hdfs://cm.macro.com:8020/hbase/WALs/cm.macro.com,60020,1541991478324/cm.macro.com%2C60020%2C1541991478324.meta.1542020334864.meta to hdfs://cm.macro.com:8020/hbase/oldWALs/cm.macro.com%2C60020%2C1541991478324.meta.1542020334864.meta
2018-11-12 20:02:26,887 WARN com.cloudera.cmf.event.publish.EventStorePublisherWithRetry: Failed to publish event: SimpleEvent{attributes={ROLE_TYPE=[REGIONSERVER], EXCEPTION_TYPES=[java.net.ConnectException], HOST_IDS=[7fb4975e-7cd2-42b6-a20e-be306e560bdd], STACKTRACE=[java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
], ROLE=[hbase-REGIONSERVER-83df30e8830a2d858ea97d96e393296f], HOSTS=[cm.macro.com], CATEGORY=[LOG_MESSAGE], EVENTCODE=[EV_LOG_EVENT], SERVICE=[hbase], SERVICE_TYPE=[HBASE], LOG_LEVEL=[WARN], SEVERITY=[IMPORTANT]}, content=Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect, timestamp=1541991481254} - 1 of 60 failure(s) in last 1814s
2018-11-12 20:02:58,700 INFO org.apache.hadoop.hbase.io.hfile.LruBlockCache: totalSize=34.15 KB, freeSize=19.32 MB, max=19.35 MB, blockCount=4, accesses=239, hits=231, hitRatio=96.65%, , cachingAccesses=235, cachingHits=228, cachingHitsRatio=97.02%, evictions=3269, evicted=3, evictedPerRun=9.177118190564215E-4
2018-11-12 20:03:55,395 INFO SecurityLogger.org.apache.hadoop.hbase.Server: Auth successful for hbase (auth:SIMPLE)
2018-11-12 20:03:55,396 INFO SecurityLogger.org.apache.hadoop.hbase.Server: Connection from 192.168.1.121 port: 41528 with version info: version: "1.2.0-cdh5.13.1" url: "file:///data/jenkins/workspace/generic-package-centos64-7-0/topdir/BUILD/hbase-1.2.0-cdh5.13.1" revision: "Unknown" user: "jenkins" date: "Thu Nov 9 08:47:05 PST 2017" src_checksum: "662aa851e2a5eb467173c7b6f9479905"
2018-11-12 20:07:58,700 INFO org.apache.hadoop.hbase.io.hfile.LruBlockCache: totalSize=34.15 KB, freeSize=19.32 MB, max=19.35 MB, blockCount=4, accesses=241, hits=233, hitRatio=96.68%, , cachingAccesses=237, cachingHits=230, cachingHitsRatio=97.05%, evictions=3299, evicted=3, evictedPerRun=9.093664702959359E-4
2018-11-12 20:08:55,530 INFO SecurityLogger.org.apache.hadoop.hbase.Server: Auth successful for hbase (auth:SIMPLE)
2018-11-12 20:08:55,530 INFO SecurityLogger.org.apache.hadoop.hbase.Server: Connection from 192.168.1.121 port: 42418 with version info: version: "1.2.0-cdh5.13.1" url: "file:///data/jenkins/workspace/generic-package-centos64-7-0/topdir/BUILD/hbase-1.2.0-cdh5.13.1" revision: "Unknown" user: "jenkins" date: "Thu Nov 9 08:47:05 PST 2017" src_checksum: "662aa851e2a5eb467173c7b6f9479905"
2018-11-12 20:12:58,700 INFO org.apache.hadoop.hbase.io.hfile.LruBlockCache: totalSize=34.15 KB, freeSize=19.32 MB, max=19.35 MB, blockCount=4, accesses=243, hits=235, hitRatio=96.71%, , cachingAccesses=239, cachingHits=232, cachingHitsRatio=97.07%, evictions=3329, evicted=3, evictedPerRun=9.011715301312506E-4
2018-11-12 20:13:55,566 INFO SecurityLogger.org.apache.hadoop.hbase.Server: Auth successful for hbase (auth:SIMPLE)
这个是其中的Hbase日志,希望能得到答复,谢谢!!!
已邀请:

Dm

赞同来自:

参照一下:https://www.cnblogs.com/huangll99/p/6646859.html
思路:可以在grokdebugger中先试着拆分一下,自带的grok-patterns中的正则应该能满足你的需求,也可以在里面添加自定义的正则匹配
http://grok.elasticsearch.cn/
 

要回复问题请先登录注册