无法在Watson Assistant wrokspace上额外/列出所有事件日志 [英] unable to extra/list all event log on watson assistant wrokspace

查看:106
本文介绍了无法在Watson Assistant wrokspace上额外/列出所有事件日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我尝试致电Watson Assistant端点 https://gateway.watsonplatform. net/assistant/api/v1/workspaces/myworkspace/logs?version = 2018-09-20 获取所有事件列表

Please help I was trying to call watson assistant endpoint https://gateway.watsonplatform.net/assistant/api/v1/workspaces/myworkspace/logs?version=2018-09-20 to get all the list of events

并使用此参数按日期范围过滤

and filter by date range using this params

var param =
{ workspace_id: '{myworkspace}',
page_limit: 100000,
filter: 'response_timestamp%3C2018-17-12,response_timestamp%3E2019-01-01'}

显然我在下面收到了空的答复.

apparently I got any empty response below.

{
"logs": [],
"pagination": {}
} 

推荐答案

要检查的事物.

1.您有2018-17-12,它是一个度量标准日期.这表示为"2018年17月12日".

1. You have 2018-17-12 which is a metric date. This translates to "12th day of the 17th month of 2018".

2.假设日期应该是一个有效的日期,您的搜索将显示"2018年12月17日之前和2019年1月1日之后的文档".这将不返回任何文件.

2. Assuming the date should be a valid one, your search says "Documents that are Before 17th Dec 2018 and after 1st Jan 2019". Which would return no documents.

3.仅当您通过API调用message()方法时才生成日志.因此,请检查工具中的日志记录页面,以查看是否还有日志.

3. Logs are only generated when you call the message() method through the API. So check your logging page in the tooling to see if you even have logs.

4.如果您有精简版帐户,则日志仅存储7天,然后删除.要保留更长的日志,您需要升级到标准帐户.

4. If you have a lite account logs are only stored for 7 days and then deleted. To keep logs longer you need to upgrade to a standard account.

尽管与您的问题没有直接关系,但请注意,page_limit具有硬编码上限(IIRC 200-300?).因此,您可能要索取100,000条记录,但不会给您.

Although not directly related to your issue, be aware that page_limit has an upper hard coded limit (IIRC 200-300?). So you may ask for 100,000 records, but it won't give it to you.

这是示例Python代码(不受支持),它正在使用分页读取日志:

This is sample python code (unsupported) that is using pagination to read the logs:

from watson_developer_cloud import AssistantV1

username = '...'
password = '...'
workspace_id = '....'
url = '...'
version = '2018-09-20'

c = AssistantV1(url=url, version=version, username=username, password=password)

totalpages = 999
pagelimit = 200
logs = []
page_count = 1
cursor = None
count = 0

x = { 'pagination': 'DUMMY' }
while x['pagination']:
    if page_count > totalpages: 
        break

    print('Reading page {}. '.format(page_count), end='')
    x = c.list_logs(workspace_id=workspace_id,cursor=cursor,page_limit=pagelimit)
    if x is None: break

    print('Status: {}'.format(x.get_status_code()))
    x = x.get_result()

    logs.append(x['logs'])
    count = count + len(x['logs'])

    page_count = page_count + 1

    if 'pagination' in x and 'next_url' in x['pagination']:
        p = x['pagination']['next_url']
        u = urlparse(p)
        query = parse_qs(u.query)
        cursor = query['cursor'][0]

您的logs对象应包含日志.

Your logs object should contain the logs.

这篇关于无法在Watson Assistant wrokspace上额外/列出所有事件日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆