Comments (3)
I just hit this too. To replicate:
cat > access.log <<EOF
localhost:443 1.2.3.4 1j0vhgd jsmith [10/Aug/2023:02:00:00 -0700] "GET /foo HTTP/2.0" 200 17163 "-" "Mozilla/5.0" 116075
localhost:443 1.2.3.4 cger1e khenry [10/Aug/2023:01:00:00 -0700] "GET /bar HTTP/2.0" 200 16517 "-" "Mozilla/5.0" 156302
EOF
lnav access.log -n -c ';select log_time from access_log;'
Expected output:
log_time
2023-08-10 02:00:00.000
2023-08-10 01:00:00.000
Actual output (lnav 0.11.2-97-g7c8d323
):
log_time
2023-08-10 02:00:00.000
2023-08-10 02:00:00.000
from lnav.
lnav expects/likes to have the messages in a file be in time-order so that it doesn't have to do heavy re-sorting work frequently. So, when that isn't the case, it treats the message as out-of-time-order and uses the timestamp from the previous log message. In the log view, you can see the original timestamp and further details by pressing p
. In the SQL interface, you can access the original timestamp with the log_actual_time
column[1].
If you really want things to be in time-order, you can patch the log file format and set the ordered-by-time
flag to false
. Patching the format can be done by putting the following fragment in a .json
file in your lnav dot directory (e.g. ~/.lnav/formats/installed or ~/.config/lnav/formats/installed)
{
"access_log": {
"ordered-by-time": false
}
}
[1] - Reading the actual time can be costly since the log message needs to be read from disk.
from lnav.
In the SQL interface, you can access the original timestamp with the [log_actual_time (https://docs.lnav.org/en/latest/sqlext.html#log-tables) column[1].
Nice, thanks.
For me this arose when I ran lnav on <(cat access.log access.log.1 | grep ...)
. It was trivial to fix the order once I knew about the log_time
behaviour, which is nicely documented in TFM I didn't R.
from lnav.
Related Issues (20)
- Latest version crashes on Arch Linux HOT 22
- $schema attribute in format file not recognized by provided jsonschema HOT 2
- Temporary folder not recreated if gone for some reason HOT 1
- When printing timestamp the last 3 microsecond digits are always "0". HOT 2
- request a release for the static init issue fix HOT 3
- Wrap text along word boundaries with the command :enable-word-wrap
- Add the ability to add multiple :filter-expr HOT 2
- Add to HIST the ability to display the number of matches based on arbitrary patterns HOT 1
- Add support for 7z archives HOT 3
- Can't open files in /tmp HOT 2
- Hangs/freezes and uses 100% CPU with small log files. HOT 1
- An option to exclude files and directories implied by `-r` (recurse) option HOT 14
- Pretty print regression for json logs HOT 4
- stdin and adb logcat -v time issues HOT 3
- 0.12.2 "top" mode navigation is broken HOT 1
- Custom theme location does not seem to work? HOT 4
- Enable native Caddy JSON log file format HOT 2
- Can it be built without Rust, disabling related module? HOT 2
- Cursor mode selection does not select expected lines HOT 1
- Feature request: hide/show "discovered fields"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lnav.