tstack / lnav

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

Found patterns are not highlighted in long lines #1162

Open Yukigaru opened 1 year ago

Yukigaru commented 1 year ago

Example: image

There's a huge line with a JSON (it's wrapped), and you can see the last ~20% are not colorized. If you search for 1685615249507568 (it's the last value in the json, in the ending), lnav will find it, but will not highlight (thus it's hard to understand where the found pattern is).

lnav version: v0.11.1, v0.8.5

To Reproduce Put this to a file:

{"topic":"orderBook_200.100ms.ETHUSDT","type":"delta","data":{"delete":[{"price":"1859.98","symbol":"ETHUSDT","id":"18599800","side":"Buy"},{"price":"1860.19","symbol":"ETHUSDT","id":"18601900","side":"Buy"},{"price":"1860.21","symbol":"ETHUSDT","id":"18602100","side":"Buy"},{"price":"1858.17","symbol":"ETHUSDT","id":"18581700","side":"Buy"},{"price":"1860.10","symbol":"ETHUSDT","id":"18601000","side":"Buy"},{"price":"1860.06","symbol":"ETHUSDT","id":"18600600","side":"Buy"},{"price":"1860.59","symbol":"ETHUSDT","id":"18605900","side":"Buy"},{"price":"1860.20","symbol":"ETHUSDT","id":"18602000","side":"Buy"},{"price":"1858.18","symbol":"ETHUSDT","id":"18581800","side":"Buy"},{"price":"1862.10","symbol":"ETHUSDT","id":"18621000","side":"Sell"},{"price":"1863.36","symbol":"ETHUSDT","id":"18633600","side":"Sell"},{"price":"1860.68","symbol":"ETHUSDT","id":"18606800","side":"Sell"},{"price":"1860.75","symbol":"ETHUSDT","id":"18607500","side":"Sell"},{"price":"1863.37","symbol":"ETHUSDT","id":"18633700","side":"Sell"},{"price":"1860.76","symbol":"ETHUSDT","id":"18607600","side":"Sell"},{"price":"1863.34","symbol":"ETHUSDT","id":"18633400","side":"Sell"},{"price":"1863.38","symbol":"ETHUSDT","id":"18633800","side":"Sell"},{"price":"1862.24","symbol":"ETHUSDT","id":"18622400","side":"Sell"},{"price":"1861.51","symbol":"ETHUSDT","id":"18615100","side":"Sell"}],"update":[{"price":"1859.69","symbol":"ETHUSDT","id":"18596900","side":"Buy","size":24.87},{"price":"1860.40","symbol":"ETHUSDT","id":"18604000","side":"Buy","size":60.99},{"price":"1859.19","symbol":"ETHUSDT","id":"18591900","side":"Buy","size":61.85},{"price":"1860.44","symbol":"ETHUSDT","id":"18604400","side":"Buy","size":37.33},{"price":"1860.23","symbol":"ETHUSDT","id":"18602300","side":"Buy","size":8.92},{"price":"1860.16","symbol":"ETHUSDT","id":"18601600","side":"Buy","size":45.59},{"price":"1860.14","symbol":"ETHUSDT","id":"18601400","side":"Buy","size":50.47},{"price":"1860.36","symbol":"ETHUSDT","id":"18603600","side":"Buy","size":17.71},{"price":"1860.03","symbol":"ETHUSDT","id":"18600300","side":"Buy","size":45.4},{"price":"1859.38","symbol":"ETHUSDT","id":"18593800","side":"Buy","size":34.49},{"price":"1860.35","symbol":"ETHUSDT","id":"18603500","side":"Buy","size":52.54},{"price":"1860.31","symbol":"ETHUSDT","id":"18603100","side":"Buy","size":49.99},{"price":"1859.31","symbol":"ETHUSDT","id":"18593100","side":"Buy","size":16.38},{"price":"1859.24","symbol":"ETHUSDT","id":"18592400","side":"Buy","size":23.36},{"price":"1858.87","symbol":"ETHUSDT","id":"18588700","side":"Buy","size":60.55},{"price":"1860.08","symbol":"ETHUSDT","id":"18600800","side":"Buy","size":1.35},{"price":"1859.34","symbol":"ETHUSDT","id":"18593400","side":"Buy","size":33.92},{"price":"1860.37","symbol":"ETHUSDT","id":"18603700","side":"Buy","size":42.66},{"price":"1860.33","symbol":"ETHUSDT","id":"18603300","side":"Buy","size":17.44},{"price":"1859.82","symbol":"ETHUSDT","id":"18598200","side":"Buy","size":45.92},{"price":"1860.46","symbol":"ETHUSDT","id":"18604600","side":"Buy","size":51.53},{"price":"1860.65","symbol":"ETHUSDT","id":"18606500","side":"Buy","size":44.72},{"price":"1860.63","symbol":"ETHUSDT","id":"18606300","side":"Buy","size":46.13},{"price":"1860.27","symbol":"ETHUSDT","id":"18602700","side":"Buy","size":17.39},{"price":"1858.91","symbol":"ETHUSDT","id":"18589100","side":"Buy","size":12.48},{"price":"1860.04","symbol":"ETHUSDT","id":"18600400","side":"Buy","size":53.24},{"price":"1859.96","symbol":"ETHUSDT","id":"18599600","side":"Buy","size":70.24},{"price":"1859.94","symbol":"ETHUSDT","id":"18599400","side":"Buy","size":26.98},{"price":"1860.42","symbol":"ETHUSDT","id":"18604200","side":"Buy","size":69.02},{"price":"1860.41","symbol":"ETHUSDT","id":"18604100","side":"Buy","size":88.16},{"price":"1859.70","symbol":"ETHUSDT","id":"18597000","side":"Buy","size":69.44},{"price":"1860.47","symbol":"ETHUSDT","id":"18604700","side":"Buy","size":3.34},{"price":"1860.13","symbol":"ETHUSDT","id":"18601300","side":"Buy","size":21.49},{"price":"1858.90","symbol":"ETHUSDT","id":"18589000","side":"Buy","size":12.92},{"price":"1860.43","symbol":"ETHUSDT","id":"18604300","side":"Buy","size":85.47},{"price":"1860.24","symbol":"ETHUSDT","id":"18602400","side":"Buy","size":66.57},{"price":"1859.92","symbol":"ETHUSDT","id":"18599200","side":"Buy","size":18.17},{"price":"1860.48","symbol":"ETHUSDT","id":"18604800","side":"Buy","size":56.35},{"price":"1860.38","symbol":"ETHUSDT","id":"18603800","side":"Buy","size":17.39},{"price":"1860.32","symbol":"ETHUSDT","id":"18603200","side":"Buy","size":33.48},{"price":"1860.62","symbol":"ETHUSDT","id":"18606200","side":"Buy","size":0.12},{"price":"1860.22","symbol":"ETHUSDT","id":"18602200","side":"Buy","size":13.6},{"price":"1860.17","symbol":"ETHUSDT","id":"18601700","side":"Buy","size":61},{"price":"1860.39","symbol":"ETHUSDT","id":"18603900","side":"Buy","size":20.07},{"price":"1860.15","symbol":"ETHUSDT","id":"18601500","side":"Buy","size":4.08},{"price":"1860.07","symbol":"ETHUSDT","id":"18600700","side":"Buy","size":45.29},{"price":"1860.67","symbol":"ETHUSDT","id":"18606700","side":"Buy","size":58.69},{"price":"1860.28","symbol":"ETHUSDT","id":"18602800","side":"Buy","size":58.77},{"price":"1860.09","symbol":"ETHUSDT","id":"18600900","side":"Buy","size":6},{"price":"1859.95","symbol":"ETHUSDT","id":"18599500","side":"Buy","size":36.59},{"price":"1859.48","symbol":"ETHUSDT","id":"18594800","side":"Buy","size":64.53},{"price":"1860.50","symbol":"ETHUSDT","id":"18605000","side":"Buy","size":3.01},{"price":"1859.26","symbol":"ETHUSDT","id":"18592600","side":"Buy","size":125.16},{"price":"1859.18","symbol":"ETHUSDT","id":"18591800","side":"Buy","size":12.62},{"price":"1862.36","symbol":"ETHUSDT","id":"18623600","side":"Sell","size":44.48},{"price":"1861.42","symbol":"ETHUSDT","id":"18614200","side":"Sell","size":60.43},{"price":"1861.68","symbol":"ETHUSDT","id":"18616800","side":"Sell","size":72.46},{"price":"1861.93","symbol":"ETHUSDT","id":"18619300","side":"Sell","size":21.14},{"price":"1863.10","symbol":"ETHUSDT","id":"18631000","side":"Sell","size":26.31},{"price":"1861.35","symbol":"ETHUSDT","id":"18613500","side":"Sell","size":24.38},{"price":"1861.60","symbol":"ETHUSDT","id":"18616000","side":"Sell","size":16.89},{"price":"1861.32","symbol":"ETHUSDT","id":"18613200","side":"Sell","size":2.51},{"price":"1861.33","symbol":"ETHUSDT","id":"18613300","side":"Sell","size":60.29},{"price":"1861.88","symbol":"ETHUSDT","id":"18618800","side":"Sell","size":38.25},{"price":"1862.55","symbol":"ETHUSDT","id":"18625500","side":"Sell","size":10.76},{"price":"1862.18","symbol":"ETHUSDT","id":"18621800","side":"Sell","size":29.01},{"price":"1863.19","symbol":"ETHUSDT","id":"18631900","side":"Sell","size":21.32},{"price":"1861.30","symbol":"ETHUSDT","id":"18613000","side":"Sell","size":8.98},{"price":"1861.43","symbol":"ETHUSDT","id":"18614300","side":"Sell","size":1.08},{"price":"1861.65","symbol":"ETHUSDT","id":"18616500","side":"Sell","size":94.21},{"price":"1861.13","symbol":"ETHUSDT","id":"18611300","side":"Sell","size":8.69},{"price":"1862.04","symbol":"ETHUSDT","id":"18620400","side":"Sell","size":96.98},{"price":"1862.21","symbol":"ETHUSDT","id":"18622100","side":"Sell","size":0.64},{"price":"1862.14","symbol":"ETHUSDT","id":"18621400","side":"Sell","size":18.21},{"price":"1861.95","symbol":"ETHUSDT","id":"18619500","side":"Sell","size":46.61},{"price":"1861.49","symbol":"ETHUSDT","id":"18614900","side":"Sell","size":86.64},{"price":"1862.54","symbol":"ETHUSDT","id":"18625400","side":"Sell","size":1.38},{"price":"1861.19","symbol":"ETHUSDT","id":"18611900","side":"Sell","size":22.56},{"price":"1861.40","symbol":"ETHUSDT","id":"18614000","side":"Sell","size":53.84},{"price":"1861.45","symbol":"ETHUSDT","id":"18614500","side":"Sell","size":14.39},{"price":"1860.96","symbol":"ETHUSDT","id":"18609600","side":"Sell","size":32.65},{"price":"1861.34","symbol":"ETHUSDT","id":"18613400","side":"Sell","size":54.37},{"price":"1861.37","symbol":"ETHUSDT","id":"18613700","side":"Sell","size":32.31},{"price":"1861.15","symbol":"ETHUSDT","id":"18611500","side":"Sell","size":32.22},{"price":"1861.25","symbol":"ETHUSDT","id":"18612500","side":"Sell","size":32.05},{"price":"1861.17","symbol":"ETHUSDT","id":"18611700","side":"Sell","size":10.06},{"price":"1861.72","symbol":"ETHUSDT","id":"18617200","side":"Sell","size":51.03},{"price":"1861.38","symbol":"ETHUSDT","id":"18613800","side":"Sell","size":30.62},{"price":"1861.41","symbol":"ETHUSDT","id":"18614100","side":"Sell","size":41.87},{"price":"1862.26","symbol":"ETHUSDT","id":"18622600","side":"Sell","size":97.67},{"price":"1861.52","symbol":"ETHUSDT","id":"18615200","side":"Sell","size":53.98}],"insert":[{"price":"1860.76","symbol":"ETHUSDT","id":"18607600","side":"Buy","size":315.47},{"price":"1860.75","symbol":"ETHUSDT","id":"18607500","side":"Buy","size":109.26},{"price":"1860.52","symbol":"ETHUSDT","id":"18605200","side":"Buy","size":15.25},{"price":"1860.57","symbol":"ETHUSDT","id":"18605700","side":"Buy","size":0.1},{"price":"1860.45","symbol":"ETHUSDT","id":"18604500","side":"Buy","size":11.37},{"price":"1859.77","symbol":"ETHUSDT","id":"18597700","side":"Buy","size":98.91},{"price":"1860.71","symbol":"ETHUSDT","id":"18607100","side":"Buy","size":2.45},{"price":"1860.64","symbol":"ETHUSDT","id":"18606400","side":"Buy","size":27.74},{"price":"1860.51","symbol":"ETHUSDT","id":"18605100","side":"Buy","size":25.27},{"price":"1861.87","symbol":"ETHUSDT","id":"18618700","side":"Sell","size":98.8},{"price":"1862.45","symbol":"ETHUSDT","id":"18624500","side":"Sell","size":163.99},{"price":"1862.43","symbol":"ETHUSDT","id":"18624300","side":"Sell","size":32.6},{"price":"1860.92","symbol":"ETHUSDT","id":"18609200","side":"Sell","size":0.16},{"price":"1861.16","symbol":"ETHUSDT","id":"18611600","side":"Sell","size":3.27},{"price":"1861.48","symbol":"ETHUSDT","id":"18614800","side":"Sell","size":0.21},{"price":"1862.47","symbol":"ETHUSDT","id":"18624700","side":"Sell","size":0.05},{"price":"1862.34","symbol":"ETHUSDT","id":"18623400","side":"Sell","size":32.6},{"price":"1860.88","symbol":"ETHUSDT","id":"18608800","side":"Sell","size":0.81},{"price":"1860.94","symbol":"ETHUSDT","id":"18609400","side":"Sell","size":11.09}],"bid1_id":"18607600","ask1_id":"18607700"},"cross_seq":"70141021998","timestamp_e6":"1685615249507568"}

Open, and search for 1685615249507568.

tstack commented 1 year ago

For the sake of performance, there's a limit on how much will be colorized. I would suggest switching to the pretty-print view (press Shift+P) and doing the search in there.

Yukigaru commented 1 year ago

Optimization out of the JSON colorization is pretty understandable. But the search itself is one of core features, and when you can't see results of a search it becomes hard to use. Please consider search results highlighting even in long lines at places where colorization is disabled.