:: Re: [DNG] Viewing file content (was…
Etusivu
Poista viesti
Vastaa
Lähettäjä: marc
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] Viewing file content (was Re: system administration of non-systemd distros and releases)
> > What could possibly be easier than vim /var/log/messages, or
> > vi /var/log/messages, or emacs /var/log/messages, or
> > nano /var/log/messages? And notice with the old way, you have a choice,
> > rather than having to look at log output with the vendor's proprietary
> > tool.
>
> Maybe I'm peculiar but I always find it absolutely, totally jaw-dropping
> when people use text *editors* to *look* at file content. Makes my toes
> curl up and blood curdle.
>
> Why on earth would you want to edit your system logs anyway?
>
> On De{bi,vu}an derivatives, I'd use `pager`. On any other Unix-based
> OS, I'd use `more` or `less`, preferably.


I concur - the model ought to be that log files aren't writeable
in the conventional sense, but append only. For installations where
one worries about security this might even be enforced with chattr
at the filesystem level (ie not just convention).

Using a pager is also more efficient - pagers are simpler, faster and
don't risk accidentally modifying the file. Depending on
editor a harmless update can involve a rename() aka mv, in which case
subsequent log entries might be lost.

If (any of) you still prefer to use an editor, consider invoking it in
read-only mode. Eg "vim" can also be invoked as "view"

regards

marc