Search code examples
pythonibm-cloud-infrastructure

SoftLayer Event_Log object filter ignoring specified timezone


I am trying to query the SoftLayer audit log (SoftLayer_Event_Log) data. I am applying an object filter based on datestamps, but the filter ignores timezone aware datestamps.

Code snippets are from Python.

Object Filter:

{u'eventCreateDate': {u'operation' : u'betweenDate',
                      u'options'   : 
                          [
                              {u'name'  : u'startDate',
                               u'value' : ['2016-02-25T19:21:53.796725+00:00']},
                              {u'name'  : u'endDate',
                               u'value' : ['2016-02-25T20:13:40.507255+00:00']}
                          ]
                     }
}

Result:

{'accountId'       : 654321,
 'eventCreateDate' : '2016-02-25T19:39:10.794659-06:00',
 'eventName'       : 'Login Successful',
 'ipAddress'       : '5.6.7.8',
 'label'           : 'username',
 'objectId'        : 123456,
 'objectName'      : 'User',
 'traceId'         : 'redacted',
 'userId'          : 123456,
 'userType'        : 'CUSTOMER',
 'username'        : 'username'}
{'accountId'       : 654321,
 'eventCreateDate' : '2016-02-25T19:39:01.567608-06:00',
 'eventName'       : 'Login Failed',
 'ipAddress'       : '1.2.3.4',
 'label'           : 'username',
 'objectId'        : 123456,
 'objectName'      : 'User',
 'traceId'         : 'redacted',
 'userId'          : '',
 'userType'        : 'SYSTEM'}
...etc...

The result data is definitely within the time specification, but not within the timezone specified.


Solution

  • The object filter ignores the timezones, it only filters the date stored in the database. If am not wrong the date in the database is stored in Dallas timezone, so you have to change your start and end date taking in account the difference between the timezone of your user and the timezone stored in the database.