Users - VertigoRay/salt-osx-grains GitHub Wiki

Users is an extraction of data returned from the last command.

There are two types of users that I care about:

  • console
  • ttys000 (shell users)

A sample of the data returned is as follows:

users:
  - console:
    - current:
      - logontime: Wed Oct 2 02:23
      - accountname: vertigoray
    - history:
      - vertigoray: 9
      - root: 1
  - ttys000:
    - current:
      - logontime: Thu Oct 24 16:02
      - accountname: vertigoray
    - history: 
      - vertigoray: 8
      - root: 1

The number after the username under each history section is the count, as returned by:

last | awk 'match($2, /console/) {print $1}' | sort | uniq -c | sort -nr