Best way to collect log files

jameson
Contributor II

When Mac users rapport issues, you always have to remove/walk to the user and typically the first you do is check log files

As far I remember during Jamf training, there is an option to get log files uploaded into the jamf backend in attachement ?. But cannot remember the details on this - but is there a way to do this?

9 REPLIES 9

jsherwood
Contributor

@jameson The API is your friend here...

You can upload files using the /fileuploads endpoint, the implementation notes from the API reference are as follows:

Implementation Notes You can POST different types of files by entering parameters for {resource}, {idType}, and {id}, for example /JSSResource/fileuploads/computers/id/2. Attachments can be uploaded by specifying computers, mobiledevices, enrollmentprofiles, printers, or peripherals as the resource. Icons can be uploaded by specifying policies, ebooks, or mobiledeviceapplicationsicon as the resource. A mobile device application can be uploaded by using mobiledeviceapplicationsipa. A disk encryption can be uploaded by specifying diskencryptionconfigurations as the resource. idTypes supported are id and name, although peripheral names are not supported. A sample command is curl -k -u user:password https://my.JamfPro:8443/JSSResource/fileuploads/computers/id/2 -F name=@/Users/admin/Documents/Sample.doc -X POST

rderewianko
Valued Contributor II

Years ago i wrote a script that did this through the api.. keep in mind all these methods do add space to your database..
https://github.com/pingidentity/CorpIT/tree/Main/JAMF%20Scripts/Diagnostic%20Logs

Granted if i was todo it again i'd upload it to s3, google drive or something else ;)

Edit: Found another version that does a bunch of checks
https://github.com/matt-taylor934/loguploader/blob/master/loguploader.sh

Brad_G
Contributor II

I found and modified a script that zips and uploads the log files to our file share where all of our techs have access. Not sure it's used much but it's another tool in the arsenal.

Here's where it came from: https://jamfnation.jamfsoftware.com/discussion.html?id=18971

Credit to @CAJensen01

mcgace
New Contributor III

@rderewianko Thanks, that Script works for me. One question, how can I modify the script to also zip the crash logs in ~/Library/Logs/DiagnosticReports/

8316637f26404e4b8c5b1ea96f066abe

nberanger
Contributor

I know this is a slightly older post, but incase anyone is looking on how to do this...

@kc9wwh Wrote a slick script that works like a charm for uploading files using the API. Check it out here:

https://github.com/kc9wwh/logCollection

brooke_burdick
New Contributor

@nberanger I feel like such a noob, but do you know where those collected log files go?! I run the script but no idea where to find them!

sdagley
Honored Contributor III

@brooke.burdick The https://github.com/kc9wwh/logCollection script uploads the collected logs to your JSS as an attachment to the Computer record for the device, and you'll find the Attachments section under the Computer's Inventory section. Be sure to delete any attachments after you download them since they do take space in your database, and the database backups made until they're deleted.

nberanger
Contributor

@sdagley You beat me to it ;-)

sdagley
Honored Contributor III

@nberanger I didn't (and still don't) see your ID as a link in the question @brooke.burdick posted, so thought the post may not have the appropriate tags embedded and you weren't going to get a notification.