2014-06-06 126 views
-3

我有我的服務器日誌,格式如下,是否可以將它轉換爲表格格式?使用AWK生成HTML表格報告

服務器日誌: -

####<Jun 1, 2014 9:28:49 AM EDT> <Error> <JMX> <Host1> <pnbprod01> <[ACTIVE] ExecuteThread: '21' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1401629329071> <BEA-149500> <An exception occurred while registering the MBean null. 
java.lang.IllegalArgumentException: Registered more than one instance with the same objectName : com.bea:ServerRuntime=server01,Name="http://server.com/:QueryInterfaceServicePort:http://192.168.56.1/epics/services/queryInterface:",ApplicationRuntime=PNB,Type=WseeClientRuntime,EJBComponentRuntime=lib/CodingServicesEJB.jar new:[email protected] - /pnbprod01[ServerRuntime]/PNB[J2EEApplicationRuntimeMBeanImpl]/lib/CodingServicesEJB.jar[EJBComponentRuntimeMBeanImpl]/ 

像這樣的事情?

表格的形式: -

 
Column1       Column2 Column3 Column4 
Jun 1, 2014 9:28:49 AM EDT  Error  JMX An exception occurred while registering 
+1

'JMX'來自哪裏?文本「發生異常......」來自哪裏? –

+0

向我們展示您的嘗試 – PradyJord

+0

哪種類型表您什麼?你有沒有想過你如何安排上面的日誌表格從? 'Column1 Column2 Column3 Column4'中是什麼?首先你大致安排上面的登錄表格形式。 –

回答

0

用awk

設置字段分隔符< 寫出標題

檢查時間戳在線

解析右側件您需要的信息基於位置和字段分隔符

awk 'BEGIN { FS="<"; print "\nColumn 1\t\t\tColumn 2\tColumn 3\tColumn 4" } /[0-9]:[0-9][0-9]/ { gsub(">", ""); print $2"\t"$3"\t\t"$4"\t\t"$14 }'