Opened 22 months ago

Last modified 22 months ago

#2238 new enhancement

Add query parameters to readFile to permit truncation of output

Reported by: Reportage Owned by:
Priority: minor Milestone: undecided
Component: api/utils Version: 0.9.34
Keywords: FileUtil, readFile, readTextFile, log viewer Cc:
Parent Tickets: Sensitive: no


Given that the default size for log files is 10MB, it would be useful to be able to send a query parameter with the url to truncate, either from the top of the log with ?head=filesize, or from the bottom with ?tail=filesize, to permit less onerous viewing of logs in the browser. Looks like readFile in FileUtil?.java is where the change needs to happen.

Additionally, it would be useful to be able to use readTextFile with query parameters to parse log files for better in-browser formatting. eg. /parse?file=/router.log&tail=256, where the head and tail queries would relate to number of lines rather than filesize.


Change History (2)

comment:1 Changed 22 months ago by zzz

Status: newinfoneeded_new

Who is sending such a query? Some external program (where this now constitutes an API), or are we putting these links in the console (where?), or is the user expected to add such parameters manually? Give us the specifics not just "it would be useful". Very unlikely to happen.

comment:2 Changed 22 months ago by Reportage

Status: infoneeded_newnew

Either by manually adding parameters, or by a configuration option, ideally with a UI. This would allow more fine-grained control over log review.. at the moment it's all or nothing, and neither option is satisfactory.. either too little data, or too much! Permitting fine-grained control of the log output size would make autorefreshing output more viable, either via a user-installed page refresh browser addon, or via a javascript/meta refresh option embedded into a log page. Adding a query parameter too filter based on event type could also prove useful. eg /router.log&tail=256&events=warn

Note: See TracTickets for help on using tickets.