Count unique users from a log file for a given time period


/ Published in: Bash
Save to your folder(s)

Sample log line:

[INFO] 2009-03-06 20:47:35 | controller::bla | user: vincentvega | ip: 127.0.0.1


Copy this code and paste it in your HTML
  1. cat xyz.log | grep "2009-03" | ruby -ne 'puts $1 if $_ =~ /user:\s(\w+)/' | sort -u | wc -l

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.