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(
614614 A list of log records.
615615 Each log record is a dictionary with the following keys: `id`, `time`, `message`.
616616 """
617- return self ._search_and_format (
617+ tail_logs = self ._search_and_format (
618618 source = source ,
619619 limit = limit ,
620- sort_order = SortOrder .ASC ,
620+ sort_order = SortOrder .DESC ,
621621 time_start = time_start ,
622622 log_filter = log_filter ,
623623 )
624+ return sorted (tail_logs , key = lambda log : log ["time" ])
624625
625626 def head (
626627 self ,
@@ -854,14 +855,15 @@ def tail(
854855 Expression for filtering the logs. This will be the WHERE clause of the query.
855856 Defaults to None.
856857 """
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+ )
857865 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" ])
865867 )
866868
867869 def head (
You can’t perform that action at this time.
0 commit comments