我分析套接字服務器的大量的日誌文件來跟蹤一些事件日誌文件,一個給定的時間比較篩選的最近2個數量級。我在使用shell腳本獲取給定時間內的最近2條消息日誌(一個在之前,另一個在給定時間之後)方面存在問題。在這種情況下,我唯一可以使用的事情是日誌文件的日期時間值與來自殼牌腳本(.ksh)
e.g. triggering time: 2013-10-31 07:29:45.311
think I have an event from another log at 2013-10-31 07:29:45.311 and need to filter
the most recent message log one is before above time and other one is after from below sample log.
given time = 2013-10-31 07:29:45.311
then triggered times for most recent log messages should be
1) before the given time: message at 2013-10-31 07:29:34.415
2) after the given time: message at 2013-10-31 07:30:34.473
可以使用shell腳本嗎?
Sample log:
2013-10-31 07:23:33.931 INFO - TTT153|Receive|0000131|....
2013-10-31 07:24:35.273 INFO - TTT153|Receive|0000131|....
2013-10-31 07:25:33.973 INFO - TTT153|Receive|0000131|....
2013-10-31 07:26:34.111 INFO - TTT153|Receive|0000131|....
2013-10-31 07:27:34.151 INFO - TTT153|Receive|0000131|....
2013-10-31 07:28:34.273 INFO - TTT153|Receive|0000131|....
2013-10-31 07:29:34.415 INFO - TTT153|Receive|0000131|....
2013-10-31 07:30:34.473 INFO - TTT153|Receive|0000131|....
2013-10-31 07:31:34.595 INFO - TTT153|Receive|0000131|....
2013-10-31 07:32:34.616 INFO - TTT153|Receive|0000131|....
2013-10-31 07:33:35.673 INFO - TTT153|Receive|0000131|....
有人下來投了這個問題,請解釋原因。 – Jotne