Group/Sort logs by thread number

Hello Experts,

For the following sample log, can you tell me how I can sort it or group it by thread number. To be specific, I just want to group them together so that its easy to analyize.

Thanks.

2012-08-17 00:00:06,369   INFO  [[ACTIVE] ExecuteThread: '33' for queue: 'weblogic.kernel.Default (self-tuning)'] service.impl.SDXInventoryImpl - Entering getNEData() for 5417543010 of com.sdx.services.impl.SDXInventoryImpl
 2012-08-17 00:00:06,369   DEBUG [[ACTIVE] ExecuteThread: '120' for queue: 'weblogic.kernel.Default (self-tuning)'] nmo.dc.RackDC - Exiting getRackInfo() for 5627562233 of com.sdx.services.nmo.dc.RackDC
2012-08-17 00:01:08,369   INFO  [[ACTIVE] ExecuteThread: '33' for queue: 'weblogic.kernel.Default (self-tuning)'] service.impl.SDXInventoryImpl - Exiting getNEData() for 5417543010 of com.sdx.services.impl.SDXInventoryImpl

I would think sort would be easiest. Assuming that the thread number is always the sixth field:

sort -k 6,6  input-file >output-file
1 Like

Thank you very much Agama. It works for me.. :slight_smile: