cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
840
Views
0
Helpful
2
Replies

Auth logs not shown under nodejs?

Ruben_Cardenal
Level 1
Level 1

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.

1 Accepted Solution

Accepted Solutions

DuoKristina
Cisco Employee
Cisco Employee

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 }));
Duo, not DUO.

View solution in original post

2 Replies 2

DuoKristina
Cisco Employee
Cisco Employee

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 }));
Duo, not DUO.

Ruben_Cardenal
Level 1
Level 1

Perfect, thanks a lot

Quick Links