mardi 30 mai 2017

Regex if or else

Currently i have 2 types of logs, one of which i want to select using regex and the other one i need to discard.

If I am getting a log, with hostname after the timestamp, then i want to select it.. hostname pattern will be same always (like, aabvabcw74.def.co.uk, aaxptac103.def.co.uk etc) Eg: 2017-04-24T09:20:01.687387+00:00 aabvabcw74.def.co.uk hostd-probe:

Anything other than this pattern i want to discard it..

2017-04-14T15:18:34.727042+00:00 Fri Apr 14 15:18:34 2017 aalesxbs029.def.co.uk lacp: DEBUG]:147, Recv signal 15, LACP service is about to stop -- It has 2 timestamp so i want to discard this log

2017-04-24T09:20:01.687387+00:00 hostd probing is done. aabvabcw74.def.co.uk hostd-probe: --- here hostd is coming as the hostname, which is wrong so i want to discard this log as well

2017-04-24T20:53:29.334348+00:00 10.199.6.5 .def.co.uk aabvabcs15.def.co.uk Fdm: sslThumbprint>95:43:64:71:A3:60:D8:17:C8:6F:68:83:92:CE:E4:3B:53:4E:1D:AD10.199.6.5a2:0e:09:01:0a:00a2:0e:09:01:0b:01/vmfs/volumes/b01f388c-aaa4889f/vmfs/volumes/6ad2d8d7-86746df14435.5.03568722host-619286aabvabcs16.def.co.uk ---- here i am getting ip address after the timestamp so i want to discard this as well

Please help me with a solution

Aucun commentaire:

Enregistrer un commentaire