Limit gam print cros output

1,273 views
Skip to first unread message

Matt S

unread,
Jun 7, 2016, 8:57:12 AM6/7/16
to Google Apps Manager
I use gam print cros every day at a scheduled time to pull data and put it into my own database.  I see that the data is inevitably growing and it's taking me longer and longer every day to sift through the data.  Is there a way to limit the output to only include data from the last "X" days, activitty from the last "X" days, and/or limit logons to last "X" number of users, etc etc?

I see there is a query that can be added to the command but I don't see any documentation on what's available in the query or what the syntax is.  I also saw a random post at some point where someone had added limit syntax into the gam print cros and suggested a merge into the code but I couldn't find if that had been completed.

Scott Burchill

unread,
Jun 7, 2016, 9:52:40 AM6/7/16
to google-ap...@googlegroups.com

I've been looking for this functionality as well.

On Jun 7, 2016 7:57 AM, "Matt S" <synt...@gmail.com> wrote:
I use gam print cros every day at a scheduled time to pull data and put it into my own database.  I see that the data is inevitably growing and it's taking me longer and longer every day to sift through the data.  Is there a way to limit the output to only include data from the last "X" days, activitty from the last "X" days, and/or limit logons to last "X" number of users, etc etc?

I see there is a query that can be added to the command but I don't see any documentation on what's available in the query or what the syntax is.  I also saw a random post at some point where someone had added limit syntax into the gam print cros and suggested a merge into the code but I couldn't find if that had been completed.

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/62a64bd5-afbb-49d6-beb5-5883e654c556%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ross Scroggs

unread,
Jun 7, 2016, 9:55:37 AM6/7/16
to google-ap...@googlegroups.com
Matt,


You'll say: gam print cros query 'query here' [nolists] [recentusers] [timeranges]

The three optional arguments limit the data that GAM outputs.

On Jun 7, 2016, at 5:57 AM, Matt S <synt...@gmail.com> wrote:

I use gam print cros every day at a scheduled time to pull data and put it into my own database.  I see that the data is inevitably growing and it's taking me longer and longer every day to sift through the data.  Is there a way to limit the output to only include data from the last "X" days, activitty from the last "X" days, and/or limit logons to last "X" number of users, etc etc?

I see there is a query that can be added to the command but I don't see any documentation on what's available in the query or what the syntax is.  I also saw a random post at some point where someone had added limit syntax into the gam print cros and suggested a merge into the code but I couldn't find if that had been completed.

Jay Lee

unread,
Jun 7, 2016, 9:58:43 AM6/7/16
to google-ap...@googlegroups.com
The delay is with manipulating the data, not pulling it from Google I assume (since that's scheduled)?

You could do something like:

gam print cros orderby lastsync | head -n 1000 > 1000-most-recent-active-cros-devices.csv

that should work on Mac and Linux, on Windows, I'm sure there's a powershell equivalent to trim the output and I'm sure it's convoluted (oops, sorry for the personal opinion on Windows / Powershell) :-)

Jay


For more options, visit https://groups.google.com/d/optout.
--

Jay

Matt S

unread,
Jun 7, 2016, 11:04:57 AM6/7/16
to Google Apps Manager
Thanks for the replies.  Yes the delay is with manipulating the data.  Some devices have 600+ columns of data because there can be over 300 recent users listed on a single (shared) chromebook.

This is the merge I mentioned finding which looks like it may do exactly what I am looking for: https://github.com/jay0lee/GAM/pull/187/commits/c4394687e65de510b79447333d7d1ab7151e21ae

I don't see any way to limit the recent users per device.  I also cannot find any documentation on what the "nolists|recentusers|timeranges" options do.

-Matt


On Tuesday, June 7, 2016 at 9:58:43 AM UTC-4, Jay Lee wrote:
The delay is with manipulating the data, not pulling it from Google I assume (since that's scheduled)?

You could do something like:

gam print cros orderby lastsync | head -n 1000 > 1000-most-recent-active-cros-devices.csv

that should work on Mac and Linux, on Windows, I'm sure there's a powershell equivalent to trim the output and I'm sure it's convoluted (oops, sorry for the personal opinion on Windows / Powershell) :-)

Jay

On Tue, Jun 7, 2016 at 9:52 AM Scott Burchill <sbur...@dasd.k12.wi.us> wrote:

I've been looking for this functionality as well.

On Jun 7, 2016 7:57 AM, "Matt S" <synt...@gmail.com> wrote:
I use gam print cros every day at a scheduled time to pull data and put it into my own database.  I see that the data is inevitably growing and it's taking me longer and longer every day to sift through the data.  Is there a way to limit the output to only include data from the last "X" days, activitty from the last "X" days, and/or limit logons to last "X" number of users, etc etc?

I see there is a query that can be added to the command but I don't see any documentation on what's available in the query or what the syntax is.  I also saw a random post at some point where someone had added limit syntax into the gam print cros and suggested a merge into the code but I couldn't find if that had been completed.

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
--

Jay

Ross Scroggs

unread,
Jun 7, 2016, 11:50:42 AM6/7/16
to google-ap...@googlegroups.com
Matt,

gam print cros [todrive] [query <Query>] [basic|full] [nolists|recentusers|timeranges] [listlimit <Number>]
        [orderby lastsync|location|notes|serialnumber|status|supportenddate|user] [ascending|descending]

listlimit is in GAM 3.65
nolist eliminates recentUsers and activeTimeRanges data
recentusers eliminates activeTimeRanges data
timeranges eliminates recentUsers data

Ross

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.

To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

Ross Scroggs

unread,
Jun 7, 2016, 1:19:57 PM6/7/16
to google-ap...@googlegroups.com
Matt,

When neither of recentusers or timeranges is specified, you get these columns: recentUsers.##.type,recentUsers.##.email, activeTimeRanges.##.date,activeTimeRanges.##.activeTime
There is one row for each CRoS device and many (up to listlimit pairs) of recentUsers and activeTimeRanges columns.

When you specify recentusers, you get these columns: recentUsers.type,recentUsers.email
When you specify timeranges, you get these columns: activeTimeRanges.date,activeTimeRanges.activeTime
There are listlimit rows for each CRoS device, one pair of values per row.

Ross

Matt,

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CAK%3DuFK3Ekts6LoWiOsPZSfu3_jGQzgc9U-U-2%3DQ81fuE_010oA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--

Jay


--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/46b2e2b4-1308-497d-ae2d-906fb666d5ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




--

Matt S

unread,
Jun 10, 2016, 7:35:28 AM6/10/16
to Google Apps Manager
listlimit works great, thanks
Reply all
Reply to author
Forward
0 new messages