How to strip logfile with grep to remove various dispensable information?

Posted by NES on Server Fault See other posts from Server Fault or by NES
Published on 2010-12-26T12:36:28Z Indexed on 2010/12/26 12:55 UTC
Read the original article Hit count: 225

Filed under:
|

My logfile has the following format:

Dec 26 13:11:48 192.168.1.1 kernel: ACCEPT IN=br0 OUT=vlan1 SRC=192.168.1.2 DST=74.125.43.147 LEN=44 TOS=0x00 PREC=0x00 TTL=63 ID=9312 DF PROTO=TCP SPT=11733 DPT=80 WINDOW=5840 RES=0x00 SYN URGP=0 OPT (020405B4) 

Now i'm trying to remove some dispensable information to make the output better readable and well arranged and put it into a new file.

The result should look like this and should only have the following information:

Dec 26 13:11:48 192.168.1.2 74.125.43.147 TCP SPT=11733 DPT=80

How to do it?

© Server Fault or respective owner

Related posts about log-files

Related posts about grep