def get_log(request):
    """MNCore.getLogRecords(session[, fromDate][, toDate][, idFilter][, event]

    [, start=0][, count=1000]) → Log

    Sorted by timestamp, id.

    """
    query = d1_gmn.app.models.EventLog.objects.all().order_by('timestamp', 'id')
    if not d1_gmn.app.auth.is_trusted_subject(request):
        query = d1_gmn.app.db_filter.add_access_policy_filter(
            request, query, 'sciobj__id'
        )
        query = d1_gmn.app.db_filter.add_redact_annotation(request, query)
    query = d1_gmn.app.db_filter.add_datetime_filter(
        request, query, 'timestamp', 'fromDate', 'gte'
    )
    query = d1_gmn.app.db_filter.add_datetime_filter(
        request, query, 'timestamp', 'toDate', 'lt'
    )
    query = d1_gmn.app.db_filter.add_string_filter(
        request, query, 'event__event', 'event'
    )
    if d1_gmn.app.views.util.is_v1_api(request):
        query = d1_gmn.app.db_filter.add_string_begins_with_filter(
            request, query, 'sciobj__pid__did', 'pidFilter'
        )
    elif d1_gmn.app.views.util.is_v2_api(request):
        query = d1_gmn.app.db_filter.add_sid_or_string_begins_with_filter(
            request, query, 'sciobj__pid__did', 'idFilter'
        )
    else:
        assert False, 'Unable to determine API version'
    total_int = query.count()
    query, start, count = d1_gmn.app.views.slice.add_slice_filter(
        request, query, total_int
    )
    return {
        'query': query,
        'start': start,
        'count': count,
        'total': total_int,
        'type': 'log',
    }