Skip to content

Instantly share code, notes, and snippets.

@trevor-vaughan
Created December 2, 2019 18:25
Show Gist options
  • Save trevor-vaughan/f86f50a5c720543d128285925d5a8f09 to your computer and use it in GitHub Desktop.
Save trevor-vaughan/f86f50a5c720543d128285925d5a8f09 to your computer and use it in GitHub Desktop.
Tlog syslog file session discovery
ruby -rjson -rpp -e 'output={}; File.read("/var/log/tlog.log").lines.map{|x| l=x.split(/\s/); foo=JSON.load(l[3..-1].join(" ")); output[foo["rec"]] ||= {:user => foo["user"], :start_time => l[0]}; output[foo["rec"]][:end_time] = l[0]}; pp output'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment