How to Log the NetworkExtension Library. The Console contains messages that are not written to any Log.

Here is a screenshot of the Console.


How do I write a script to Gather these NETWORKEXTENSION Messages that are not written to any log.


I have attempted


$ sudo defaults write /Library/Preferences/com.apple.networkextension.control.plist LogToFile -boolean true

$ sudo defaults write /Library/Preferences/com.apple.networkextension.control.plist LogLevel -int 7

$ /System/Library/Frameworks/SystemConfiguration.framework/Resources/get-mobility-info


But do not see any reference to the messages from the NetworkExtension Library as I do in the Console.

example:


Having these logs will assist me in troubleshooting the Connection of the IKEv2 VPN profile status.

Accepted Reply

You can use the

show
subcommand to dump the log. Use
--predicate
to filter for specific messages and
--style
to set the output style. Read the
log
man page for the details.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

Here is a screenshot of the Console.

Alas, that didn’t make it. DevForums does not currently let you post images (r. 22028729). You will have to post the image to some image hosting service and then post a URL. That URL will require moderation approval but I can take care of that.

What platform are you working on? And what OS version?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Mac OS: Sierra : IKEv2 VPN Connection Log


The steps to visually see the messages are as follows:

-Open Console App

-In Left Pane select just the Single Computer Device

-then in the Search field Type "networkextension"

-most likely nothing would be displayed yet

-Now connect to IKEV2 VPN ->Button or ->Menue Bar

-Watch as nesessionmanager and neagent send messages to the console

-how can this be programitically captured by a script or app? Is there a log file of this?


Thank you so much for your responses.

Jason Brodsky

Is there a log file of this?

Not in any traditional sense.

how can this be programitically captured by a script or app?

From a script you can use

log
.

There’s currently no API for read log messages. WWDC 2016 Session 721 Unified Logging and Activity Tracing has the background to this whole issue and covers this point specifically. Quoting from the transcript:

First off, all of the ASL logging APIs are now superseded by these new APIs and, therefore, those old APIs are deprecated.

There is an interesting edge case though. A new API for searching the log data is not going to be made public in this release.

What that means is that there’s no equivalent to asl search functionality.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

$ log --collect Fantastic command Now how to either: 1) extract certain elements and save to spreadsheet or 2) save whole console.log file to a spreadsheet Thank You, You keep me warm Eskimo. It's a New Year!

You can use the

show
subcommand to dump the log. Use
--predicate
to filter for specific messages and
--style
to set the output style. Read the
log
man page for the details.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Beautiful, here is my bash command that I created to place all the NETWORKEXTENSION AND NEAGENT messages into a text file.

___________

log show ${TEMPDIR}/system_logs.logarchive --predicate '(subsystem == "com.apple.networkextension") || (process == "neagent")' --style json &> ${TEMPDIR}/NETWORKEXTENSION.log.txt

___________

The World is Mine Now.


Thank You, Jason Brodsky

Is there any way to do it at the app, programmatically ?

I want to add a button that will collect the logs when clicked.

Is there any way to do it at the app, programmatically ?

Not really. My earlier post (which was dated Dec 28, 2016 and is now date Jan 26, 2017) has the relevant explanation. It was hard to see because I completely fluffed the formatting. Sorry about that. I’ve fixed it now (which explains the date change).

If you’re working on macOS you could do something like this by using NSTask (or whatever) to run the

log
tool itself. However, I generally don’t recommend that sort of thing. A better option, IMO, is to ask the user to send you a sysdiagnose log, which includes this log. See the info on our Bug Reporting > Profiles and Logs page.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

roee84, I am building a similar tool

Just run a Few Bash Command Scripts from a button click app/menue

Create Temp Directory


$ log --collect


places the giant log file 300megs to 3gigs into this directory

then parse the important info from it into a JSON text file


$ log show ${TEMPDIR}/system_logs.logarchive --predicate '(subsystem == "com.apple.networkextension") || (process == "neagent")' --style json &> ${TEMPDIR}/NETWORKEXTENSION.log.txt


then upload the file whereever


Took me a bit to find this golden information. Thank you eskimo for the help

ok, will do that.

Thanks as usual escimo!