lnav icon indicating copy to clipboard operation
lnav copied to clipboard

lnav in headless mode executes commands before it has finished reading all log files

Open heimburgerj2 opened this issue 8 months ago • 1 comments

lnav version lnav 0.12.3

Describe the bug

My log folder contains more than 1K log files (1,3 GB) and lnav takes about a minute to read all the log files.

I have a shell script, which expects the logs folder as argument:

lnav -v -r $1  -c "|export-some-data-to-csv.lnav M RE" -c :quit

The above script works fine.

However, when I use the same script but run lnav in headless mode like this:

lnav -n -v -r $1  -c "|export-some-data-to-csv.lnav M RE" -c :quit

then the commands are executed before lnav has finished reading the log files obviously. The script is executed without error, but the result only contains a small part of the result, which is produced without headless mode.

To Reproduce Steps to reproduce the behavior:

  • Run lnav via CLI in headless mode using a command, which retrieves data from all log files in a large logs folder.

heimburgerj2 avatar Jun 04 '25 11:06 heimburgerj2

Would you be able to run lnav with -d /tmp/lnav-dbg.out so it writes out a debug log and I can take a closer look.

lnav is supposed to scan the available files and read in their data before executing the commands from the command-line. It seems to work for the files I'm testing with. So, some extra details from the debug might help me figure out what is happening.

tstack avatar Jun 04 '25 23:06 tstack

I'm not able to replicate this with the top-of-tree and without a debug log, it's hard to know what might've happened. Going to close.

tstack avatar Dec 06 '25 17:12 tstack