Problema ao ler o conteúdo do arquivo de log a cada 30 minutos

1

Eu preciso ler o conteúdo de um arquivo mycustomfile.log a cada 30 minutos no linux

Eu tentei egrep "06:00| 06:30"

Mas não estou obtendo os resultados desejados.

06:00:24  rdy->395  bsy->205  ka->29 
06:30:27  rdy->339  bsy->261  ka->40 
07:00:30  rdy->259  bsy->341  ka->80 
**07:06:30  rdy->282  bsy->318  ka->73** 
**07:07:30  rdy->234  bsy->366  ka->80** 
07:30:32  rdy->455  bsy->445  ka->85

os resultados acima destacados com ** estão entre as entradas corretas. Preciso excluí-los e preciso ver os resultados em 30 minutos.

O que estou perdendo?

ATUALIZAÇÃO  Abaixo está o meu arquivo de entrada:

[Thu Mar 30 00:00:37 2017] [notice] mpmstats: rdy 26 bsy 49 rd 45 wr 1 ka 3 log 0 dns 0 cls 0

[Thu Mar 30 00:10:38 2017] [notice] mpmstats: rdy 46 bsy 54 rd 53 wr 0 ka 1 log 0 dns 0 cls 0

[Thu Mar 30 00:20:39 2017] [notice] mpmstats: rdy 55 bsy 45 rd 45 wr 0 ka 0 log 0 dns 0 cls 0

[Thu Mar 30 00:30:39 2017] [notice] mpmstats: rdy 48 bsy 52 rd 51 wr 0 ka 1 log 0 dns 0 cls 0

[Thu Mar 30 00:40:40 2017] [notice] mpmstats: rdy 74 bsy 26 rd 23 wr 0 ka 1 log 0 dns 0 cls 2

[Thu Mar 30 00:50:41 2017] [notice] mpmstats: rdy 44 bsy 14 rd 12 wr 0 ka 2 log 0 dns 0 cls 0

[Thu Mar 30 01:00:41 2017] [notice] mpmstats: rdy 41 bsy 9 rd 9 wr 0 ka 0 log 0 dns 0 cls 0

[Thu Mar 30 01:10:42 2017] [notice] mpmstats: rdy 39 bsy 11 rd 5 wr 0 ka 6 log 0 dns 0 cls 0
[Thu Mar 30 01:20:42 2017] [notice] mpmstats: rdy 45 bsy 5 rd 5 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 01:30:43 2017] [notice] mpmstats: rdy 31 bsy 19 rd 18 wr 0 ka 1 log 0 dns 0 cls 0
[Thu Mar 30 01:40:44 2017] [notice] mpmstats: rdy 59 bsy 16 rd 16 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 01:50:44 2017] [notice] mpmstats: rdy 62 bsy 13 rd 13 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 02:00:45 2017] [notice] mpmstats: rdy 70 bsy 5 rd 5 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 02:10:45 2017] [notice] mpmstats: rdy 69 bsy 6 rd 5 wr 0 ka 1 log 0 dns 0 cls 0
[Thu Mar 30 02:20:46 2017] [notice] mpmstats: rdy 57 bsy 18 rd 18 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 02:30:47 2017] [notice] mpmstats: rdy 69 bsy 6 rd 6 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 02:40:47 2017] [notice] mpmstats: rdy 69 bsy 6 rd 6 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 02:50:48 2017] [notice] mpmstats: rdy 73 bsy 2 rd 2 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 03:30:50 2017] [notice] mpmstats: rdy 72 bsy 3 rd 3 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 03:40:51 2017] [notice] mpmstats: rdy 72 bsy 3 rd 3 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 03:50:52 2017] [notice] mpmstats: rdy 74 bsy 1 rd 1 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 04:00:52 2017] [notice] mpmstats: rdy 74 bsy 1 rd 1 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 04:10:53 2017] [notice] mpmstats: rdy 73 bsy 2 rd 2 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 04:20:54 2017] [notice] mpmstats: rdy 64 bsy 11 rd 11 wr 0 ka 0 log 0 dns 0 cls 0
[Thu Mar 30 04:30:54 2017] [notice] mpmstats: rdy 71 bsy 4 rd 4 wr 0 ka 0 log 0 dns 0 cls 0
    
por user593450 30.03.2017 / 09:42

1 resposta

0

O padrão grep que você está usando pode fornecer minutos: segundos em vez de horas: minutos

O seguinte grep será mais preciso:

Note que adicionei ":" após os minutos, para indicar que também há segundos.

egrep "06:00:|06:30:"

Ou um grep mais geral:

egrep ":00:|:30:"
    
por 30.03.2017 / 09:50

Tags