如何從當前日期的日誌文件中選擇所有ERROR和WARN和FATAL行?提前致謝。在日誌文件中查找模式
我的日誌文件如下所示。
[2017-04-24 17:26:48,385] WARN ******* GOODBYE /10.170.208.1:35084 ******** (org.apache.zookeeper.server.quorum.LearnerHandler)
[2017-04-24 17:26:48,385] WARN Ignoring unexpected exception (org.apache.zookeeper.server.quorum.LearnerHandler)
java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1220)
at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:335)
at java.util.concurrent.LinkedBlockingQueue.put(LinkedBlockingQueue.java:339)
at org.apache.zookeeper.server.quorum.LearnerHandler.shutdown(LearnerHandler.java:654)
at org.apache.zookeeper.server.quorum.LearnerHandler.run(LearnerHandler.java:647)
[2017-04-24 17:26:48,385] INFO Reading snapshot /bnsf/kafka/zookeeper/version-2/snapshot.900000000 (org.apache.zookeeper.server.persistence.FileSnap)
[2017-04-24 17:26:48,476] INFO Notification: 1 (message format version), 1 (n.leader), 0x243970000003b (n.zxid), 0x243aa (n.round), LOOKING (n.state), 1 (n.sid), 0x243a5 (n.peerEpoch) LOOKING (my state) (org.apache.zookeeper.server.quorum.FastLeaderElection)
[2017-04-24 17:26:48,496] INFO Notification: 1 (message format version), 2 (n.leader), 0x243970000003b (n.zxid), 0x243aa (n.round), LOOKING (n.state), 2 (n.sid), 0x243a5 (n.peerEpoch) LOOKING (my state) (org.apache.zookeeper.server.quorum.FastLeaderElection)
[
使用grep。看到男人grep –