tstack / lnav

Log file navigator
http://lnav.org
BSD 2-Clause "Simplified" License
7.99k stars 322 forks source link

Remote logs aren't updated #1005

Open lutek opened 2 years ago

lutek commented 2 years ago

lnav version 0.10.1

Describe the bug Remote logs aren't reloaded/updated

lnav db1-57:/var/log/mysql/error.log

ssh config:

Host db1-57
    HostName 10.22.19.33
    User root

image

tstack commented 2 years ago

Why did you close this?

lutek commented 2 years ago

I thought that problem was related to log file size, but its not that. After delete large log file problem still exists:

image

tstack commented 2 years ago

Can you run lnav with -d /tmp/lnav-dbg.log and then attach that file, it might help in diagnosing the issue.

From the screenshot, the "error.log" file might have some non-UTF-8 data, is that true? I'm wondering if that's why it's not updating anymore. Does it start out hidden and then you have to unhide it?

seryte commented 2 years ago

By the way, How to use lnav on a remote server like tail -f /var/log/log.log | ssh root@remote "lnav" but remote lnav return failed error: stdout is not a tty.

lutek commented 2 years ago

yes it show "hiding non-utf file", but this is always for next try, after deleting log and open as new there is no problem. Perhaps there apearing some non utf data, after first parse. I'm trying to find in manual how to enable non-utf this but, i can't.

lnav-dbg.log

tstack commented 2 years ago

By the way, How to use lnav on a remote server like tail -f /var/log/log.log | ssh root@remote "lnav" but remote lnav return failed error: stdout is not a tty.

@seryte Have you read this blog post -- https://lnav.org/2021/05/03/tailing-remote-files.html ?

seryte commented 2 years ago

By the way, How to use lnav on a remote server like tail -f /var/log/log.log | ssh root@remote "lnav" but remote lnav return failed error: stdout is not a tty.

@seryte Have you read this blog post -- https://lnav.org/2021/05/03/tailing-remote-files.html ? This is used remotely on a machine with lnav, lnav root@remote:/var/log/messages. this does work, but what I want is the reverse, on a machine without lnav via pipe notation | use lnav on the remote machine

[root@remote1 ~]# kubectl logs -f pod1  | ssh root@remote "lnav"                                                                                                        
Authorized uses only. All activity may be monitored and reported.
error: stdout is not a tty.
usage: lnav [options] [logfile1 logfile2 ...]

A curses-based log file viewer that indexes log messages by type
and time to make it easier to navigate through files quickly.

Key bindings:
  ?     View/leave the online help text.
  q     Quit the program.

Options:
  -h         Print this message, then exit.
  -H         Display the internal help text.
  -I path    An additional configuration directory.
  -i         Install the given format files and exit.  Pass 'extra'
             to install the default set of third-party formats.
  -u         Update formats installed from git repositories.
  -C         Check configuration and then exit.
  -d path    Write debug messages to the given file.
  -V         Print version information.

  -a         Load all of the most recent log file types.
  -r         Recursively load files from the given directory hierarchies.
  -R         Load older rotated log files as well.
  -t         Prepend timestamps to the lines of data being read in
             on the standard input.
  -w file    Write the contents of the standard input to this file.

  -c cmd     Execute a command after the files have been loaded.
  -f path    Execute the commands in the given file.
  -n         Run without the curses UI. (headless mode)
  -N         Do not open the default syslog file if no files are given.
  -q         Do not print the log messages after executing all
             of the commands.

Optional arguments:
  logfileN          The log files, directories, or remote paths to view.
                    If a directory is given, all of the files in the
                    directory will be loaded.
Examples:
  To load and follow the syslog file:
    $ lnav

  To load all of the files in /var/log:
    $ lnav /var/log

  To watch the output of make with timestamps prepended:
    $ make 2>&1 | lnav -t

Paths:
  Configuration, session, and format files are stored in:
    ð /root/.lnav

  Local copies of remote files and files extracted from
  archives are stored in:
    ð /tmp/lnav-user-0-work

Documentation: https://docs.lnav.org
Contact:
  ð¬ https://github.com/tstack/lnav/discussions
  ð« lnav@googlegroups.com
Version: lnav 0.10.1-dirty
tstack commented 2 years ago

Try passing -t to ssh to allocate a pty.

seryte commented 2 years ago

Try passing -t to ssh to allocate a pty.

this still doesn't work [root@remote1 ~]# kubectl logs -f pod1 | ssh -t root@remote "lnav" error: stdout is not a tty.