File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -614,13 +614,14 @@ def tail(
614
614
A list of log records.
615
615
Each log record is a dictionary with the following keys: `id`, `time`, `message`.
616
616
"""
617
- return self ._search_and_format (
617
+ tail_logs = self ._search_and_format (
618
618
source = source ,
619
619
limit = limit ,
620
- sort_order = SortOrder .ASC ,
620
+ sort_order = SortOrder .DESC ,
621
621
time_start = time_start ,
622
622
log_filter = log_filter ,
623
623
)
624
+ return sorted (tail_logs , key = lambda log : log ["time" ])
624
625
625
626
def head (
626
627
self ,
@@ -854,14 +855,15 @@ def tail(
854
855
Expression for filtering the logs. This will be the WHERE clause of the query.
855
856
Defaults to None.
856
857
"""
858
+ tail_logs = self ._search_and_format (
859
+ source = source ,
860
+ limit = limit ,
861
+ sort_order = SortOrder .DESC ,
862
+ time_start = time_start ,
863
+ log_filter = log_filter ,
864
+ )
857
865
self ._print (
858
- self ._search_and_format (
859
- source = source ,
860
- limit = limit ,
861
- sort_order = SortOrder .ASC ,
862
- time_start = time_start ,
863
- log_filter = log_filter ,
864
- )
866
+ sorted (tail_logs , key = lambda log : log ["time" ])
865
867
)
866
868
867
869
def head (
You can’t perform that action at this time.
0 commit comments