[j-nsp] why is "show log messages | last 10" so slow?

Hugo Slabbert hugo at slabnet.com
Mon Oct 29 12:47:04 EDT 2018


On Mon 2018-Oct-29 16:28:12 +0000, Anderson, Charles R <cra at wpi.edu> wrote:

>Why is "show log messages | last 10" so slow with a large log file when I 
>can go to the shell and run "tail -10 /var/log/messages" much more 
>quickly?

Because it's an action that is done after the pipe rather than being the 
action itself, so it's equivalent to `cat /var/log/messages | tail -n 10` 
not directly to `tail -n 10 /var/log/messages`.  It's a generic pipe action 
that can be applied to any text output, e.g. the output of a regular 
operational "show" command, but it's not a top-level command that does file 
processing itself like `tail` can.

>Maybe JUNOS can borrow the implementation of the "tail" command to make it 
>quicker.

They'd have to add a new top-level command or perhaps add a parameter to 
the `file show` operation, I'd think.  Probably doable, but not sure how 
much traction the feature request would get.

-- 
Hugo Slabbert       | email, xmpp/jabber: hugo at slabnet.com
pgp key: B178313E   | also on Signal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://puck.nether.net/pipermail/juniper-nsp/attachments/20181029/997ff52d/attachment.sig>


More information about the juniper-nsp mailing list