11-23-2021 01:29 PM
Hello,
We have this:
client.jsonApiCall('GET', '/admin/v2/logs/authentication', { mintime: '1637616411572', maxtime: '1637702811573', users: '■■■■■■■■■■■■■■■■■■■■' }, console.log);
which returns:
{
response: {
authlogs: [ [Object], [Object], [Object] ],
metadata: { next_offset: [Array], total_objects: 3 }
},
stat: 'OK'
}
How do I get to see the contents of those “Object” fields?
Thanks.
Solved! Go to Solution.
11-23-2021 03:54 PM
Try using util.inspect with both maxArrayLength: null, depth: null
. My output went from:
{
authlogs: [
{
access_device: [Object],
alias: '',
application: [Object],
auth_device: [Object],
email: '',
event_type: 'authentication',
factor: 'duo_push',
isotimestamp: '2021-11-15T17:53:15.175050+00:00',
ood_software: null,
reason: 'user_mistake',
result: 'denied',
timestamp: 1636998795,
trusted_endpoint_status: 'not trusted',
txid: '9e3319e3-7876-nnnn-a485-a5f1afd9ed06',
user: [Object]
}
],
metadata: {
next_offset: [ '1636998795175', '9e3319e3-7876-nnnn-a485-a5f1afd9ed06' ],
total_objects: 1
}
}
to
{
authlogs: [
{
access_device: {
browser: 'Chrome',
browser_version: '95.0.4638.69',
epkey: 'EPblahblah',
flash_version: 'uninstalled',
hostname: null,
ip: '136.n.n.n',
is_encryption_enabled: 'unknown',
is_firewall_enabled: 'unknown',
is_password_set: 'unknown',
java_version: 'uninstalled',
location: { city: 'Austin', country: 'United States', state: 'Texas' },
os: 'Linux',
os_version: '',
security_agents: 'unknown'
},
alias: '',
application: { key: 'DIblahblah', name: 'Web SDK 145' },
auth_device: {
ip: '136.n.n.n',
location: { city: 'Austin', country: 'United States', state: 'Texas' },
name: 'Motorola Moto G Power'
},
email: '',
event_type: 'authentication',
factor: 'duo_push',
isotimestamp: '2021-11-15T17:53:15.175050+00:00',
ood_software: null,
reason: 'user_mistake',
result: 'denied',
timestamp: 1636998795,
trusted_endpoint_status: 'not trusted',
txid: '9e3319e3-7876-nnnn-a485-a5f1afd9ed06',
user: { groups: [], key: 'DUblahblah', name: 'someuser' }
}
],
metadata: {
next_offset: [ '1636998795175', '9e3319e3-7876-nnnn-a485-a5f1afd9ed06' ],
total_objects: 1
}
}
I guess I no longer can claim “zero node experience”.
FWIW I have just been riffing off the demo duo_admin.js script, and I changed the console output lines to:
res = res.response;
const util = require('util')
console.log(util.inspect(res, { maxArrayLength: null, depth: null }));
11-23-2021 03:54 PM
Try using util.inspect with both maxArrayLength: null, depth: null
. My output went from:
{
authlogs: [
{
access_device: [Object],
alias: '',
application: [Object],
auth_device: [Object],
email: '',
event_type: 'authentication',
factor: 'duo_push',
isotimestamp: '2021-11-15T17:53:15.175050+00:00',
ood_software: null,
reason: 'user_mistake',
result: 'denied',
timestamp: 1636998795,
trusted_endpoint_status: 'not trusted',
txid: '9e3319e3-7876-nnnn-a485-a5f1afd9ed06',
user: [Object]
}
],
metadata: {
next_offset: [ '1636998795175', '9e3319e3-7876-nnnn-a485-a5f1afd9ed06' ],
total_objects: 1
}
}
to
{
authlogs: [
{
access_device: {
browser: 'Chrome',
browser_version: '95.0.4638.69',
epkey: 'EPblahblah',
flash_version: 'uninstalled',
hostname: null,
ip: '136.n.n.n',
is_encryption_enabled: 'unknown',
is_firewall_enabled: 'unknown',
is_password_set: 'unknown',
java_version: 'uninstalled',
location: { city: 'Austin', country: 'United States', state: 'Texas' },
os: 'Linux',
os_version: '',
security_agents: 'unknown'
},
alias: '',
application: { key: 'DIblahblah', name: 'Web SDK 145' },
auth_device: {
ip: '136.n.n.n',
location: { city: 'Austin', country: 'United States', state: 'Texas' },
name: 'Motorola Moto G Power'
},
email: '',
event_type: 'authentication',
factor: 'duo_push',
isotimestamp: '2021-11-15T17:53:15.175050+00:00',
ood_software: null,
reason: 'user_mistake',
result: 'denied',
timestamp: 1636998795,
trusted_endpoint_status: 'not trusted',
txid: '9e3319e3-7876-nnnn-a485-a5f1afd9ed06',
user: { groups: [], key: 'DUblahblah', name: 'someuser' }
}
],
metadata: {
next_offset: [ '1636998795175', '9e3319e3-7876-nnnn-a485-a5f1afd9ed06' ],
total_objects: 1
}
}
I guess I no longer can claim “zero node experience”.
FWIW I have just been riffing off the demo duo_admin.js script, and I changed the console output lines to:
res = res.response;
const util = require('util')
console.log(util.inspect(res, { maxArrayLength: null, depth: null }));
11-24-2021 12:57 AM
Perfect, thanks a lot
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide