Hi Eskimo! Thanks for answering.
I'm trying to Fetch MAC system logs using swift in Xcode (OsLogStore Api). My Code is something like this to Print logs for the Past 1 minute.
func main() throws {
let store = try OSLogStore.local()
let interval = store.position(timeIntervalSinceEnd: -60.0)
let entries = try store.getEntries(with: [], at: interval, matching: nil)
for e in entries {
print(e.date, e.composedMessage)
}
}
try! main()
Reference for this code : Example code
As Expected I am getting some log like output. But this logs are not matching with the logs Showing in Console application. And also most of the log entries saying 'doesn't have get-task-allow' (This type of logs were not in Displayed in console).
`
Sample Output when I executed the above swift code :
2021-08-24 08:04:56 +0000 initiating malware scan (activeRulesVersion: 11555676988044606669 lastScanVersion: 10415043430518216312 chgtime: 1628617978 lastFileScanTime: 1628619174 pid: 17339 info_path: /Users/test/Downloads/Xcode 2.app/Contents/PlugIns/DebuggerFoundation.ideplugin/Contents/MacOS/DebuggerFoundation proc_path: /Users/test/Downloads/Xcode 2.app/Contents/Developer/usr/bin/xcodebuild
2021-08-24 08:04:56 +0000 Starting malware scan for: /Users/test/Downloads/Xcode 2.app/Contents/PlugIns/DebuggerFoundation.ideplugin/Contents/MacOS/DebuggerFoundation
2021-08-24 08:04:56 +0000 Outer bundle for: /Users/test/Downloads/Xcode 2.app/Contents/PlugIns/DebuggerFoundation.ideplugin/Contents/MacOS/DebuggerFoundation is /Users/test/Downloads/Xcode 2.app
2021-08-24 08:04:56 +0000 Recording cache miss for /Users/test/Downloads/Xcode 2.app/Contents/PlugIns/DebuggerFoundation.ideplugin/Contents/MacOS/DebuggerFoundation
2021-08-24 08:04:56 +0000 macOSTaskPolicy: (kav) may not get the kernel task port: SIP is on and (kav) is not entitled or whitelisted
2021-08-24 08:04:56 +0000 macOSTaskPolicy: (kav) may not get the taskport of (launchd) (pid: 1): (launchd) is hardened, (launchd) doesn't have get-task-allow, (kav) is not a declared debugger
2021-08-24 08:04:56 +0000 macOSTaskPolicy: (kav) may not get the taskport of (UserEventAgent) (pid: 96): (UserEventAgent) is hardened, (UserEventAgent) doesn't have get-task-allow, (kav) is not a declared debugger
I need to Print a proper system log using Swift code. Is there any configuration that I am missing to achieve this goal?