Jump to content

Question

Posted

Ощущение что в логах две отдельные таблицы, делаешь выборку по тексту, находит текст без даты, делаешь выборку по дате, выдаёт только дату.

необходимо сделать вывод строки полностью, иначе пользоваться такой выборкой невозможно.

примеры:

 

(config)> show log onc

 Usage template:
              log [{max-lines}] [once]

(config)> show log once | grep NAK
=====================
  Time              Message
=====================
I [??? ?? ??:??:??] : FastEthernet0/Vlan4000: recieved NAK.
I [??? ?? ??:??:??] : FastEthernet0/Vlan4000: recieved NAK.
I [??? ?? ??:??:??] : FastEthernet0/Vlan4000: recieved NAK.
I [??? ?? ??:??:??] : FastEthernet0/Vlan4000: recieved NAK.
I [??? ?? ??:??:??] : FastEthernet0/Vlan4000: recieved NAK.
I [??? ?? ??:??:??] : FastEthernet0/Vlan4000: recieved NAK.
I [??? ?? ??:??:??] : FastEthernet0/Vlan4000: recieved NAK.
I [??? ?? ??:??:??] : FastEthernet0/Vlan4000: recieved NAK.

(config)> show log once | grep 11:07:31
=====================
 Time             Message
=====================
 [Jan  5 11:07:31] :
 [Jan  5 11:07:31] :
 [Jan  5 11:07:31] :

(config)> show log once | grep SSH

====================
  Time              Message
====================
I [??? ?? ??:??:??] : Ssh::Manager: SSH server enabled.
I [??? ?? ??:??:??] : Core::Authenticator: "*" logged in, SSH authenticated.
I [??? ?? ??:??:??] : Core::Authenticator: "*" logged in, SSH authenticated.
I [??? ?? ??:??:??] : Core::Authenticator: "*" logged in, SSH authenticated.

 

получается что сейчас вижу что произошло событие, но не знаю когда

2 answers to this question

Recommended Posts

  • 0
Posted
1 час назад, kirk88 сказал:

получается что сейчас вижу что произошло событие, но не знаю когда

Попробуйте так

show log once | grep -C 1 NAK

 

  • Upvote 1
  • 0
Posted
5 часов назад, sergeyk сказал:

Попробуйте так

show log once | grep -C 1 NAK

 

действительно так показывает, благодарю.

 

(config)> show log once | grep -C 1 NAK
========================================================================================================================
  Time              Message
========================================================================================================================
I [Dec 23 16:54:31] ndhcpc: FastEthernet0/Vlan4000: recieved NAK.
I [Dec 24 16:55:28] ndhcpc: FastEthernet0/Vlan4000: recieved NAK.
I [Dec 26 17:02:21] ndhcpc: FastEthernet0/Vlan4000: recieved NAK.
I [Dec 28 17:09:15] ndhcpc: FastEthernet0/Vlan4000: recieved NAK.
I [Dec 29 17:10:11] ndhcpc: FastEthernet0/Vlan4000: recieved NAK.
I [Dec 31 17:17:03] ndhcpc: FastEthernet0/Vlan4000: recieved NAK.
I [Jan  1 17:18:00] ndhcpc: FastEthernet0/Vlan4000: recieved NAK.
I [Jan  2 17:18:56] ndhcpc: FastEthernet0/Vlan4000: recieved NAK.
I [Jan  5 17:31:46] ndhcpc: FastEthernet0/Vlan4000: recieved NAK.

 

 

здорово было бы добавить к консоль man по команде grep через tab или ? что б не запоминать возможные переменные grep

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

This site uses cookies. By clicking "I accept" or continuing to browse the site, you authorize their use in accordance with the Privacy Policy.