papertrail / papertrail-cli

Command-line client for Papertrail hosted syslog & app log management service
http://papertrailapp.com/
MIT License
426 stars 46 forks source link

Limit number of rows returned #23

Open ghost opened 12 years ago

ghost commented 12 years ago

It would be very handy if you could limit the number of rows returned.

e.g: papertrail -n 1 -s systemname

To return just the latest log line for a system.

troy commented 12 years ago

Thanks for the suggestion, Robert. If you're comfortable sharing what led you to want the last message, that would be really helpful.

Also, would you use that instead of piping it through head -1 (if you've tried it)?

ghost commented 12 years ago

Yeah, piping it into tail is what i'm doing now.

What i'm using it for specifically is finding the most recent (i.e: last) message in papertrail for a host, to check that centralised messages are still being received for each host. It'd be even better if you could give -s systemname -l and get back the epoch time of the last message, or something, but limiting the rows returned and having to process the timestamp is also ok.