• 根据条件获取操作日志

    根据条件获取操作日志

    • API: POST /api/v3/audit/search
    • API 名称:get_operation_log
    • 功能说明:
      • 中文: 获取操作日志
      • English:get operation log
    • input:

      1. {
      2. "condition":{
      3. "bk_biz_id":99999,
      4. "ext_key":{
      5. "$in":[
      6. "127.0.0.23",
      7. "127.0.0.22"
      8. ]
      9. },
      10. "op_target":"host",
      11. "op_type":"add",
      12. "op_time":[
      13. "2017-12-25 10:10:10",
      14. "2017-12-25 10:10:11"
      15. ]
      16. },
      17. "start":0,
      18. "limit":10,
      19. "sort":"-create_time"
      20. }
    • input 参数说明

    名称 类型 必填 默认值 说明 Description
    bk_biz_id int 业务ID business ID
    ext_key object 当bk_op_type为0, 填入多个IP地址 if bk_op_type=0, the input is ip array
    op_target string 操作对象,可以为biz host process set module object op target, and it can be biz host process set module object
    op_type string 操作类型, add delete update op type, and it can be add , delete ,update
    op_time string数组 没有条件,为空, 开始和结束时间成对出现 no condition, start time and end time is pair
    start int 记录开始位置 start record
    limit int 每页限制条数,最大200 page limit, max is 200
    sort string 排序字段 the field for sort

    ext_key 字段说明: 为根据ip的匹配搜索

    • output
    1. {
    2. "result":true,
    3. "bk_error_code":0,
    4. "bk_error_msg":null,
    5. "data":{
    6. "count":1,
    7. "info":[
    8. {
    9. "bk_supplier_account":"0",
    10. "bk_biz_id":1,
    11. "op_desc":"修改主机",
    12. "op_type":2,
    13. "op_target":"host",
    14. "operator":"admin",
    15. "content":{
    16. "pre_data":{
    17. "last_time":"2018-03-08T15:10:42.264+08:00",
    18. "bk_cloud_id":[
    19. {
    20. "ref_id":1,
    21. "ref_name":"Direct connecting area"
    22. }
    23. ],
    24. "create_time":"2018-03-08T14:23:05.05+08:00",
    25. "bk_host_id":1,
    26. "bk_host_innerip":"127.0.01",
    27. "bk_import_from":"1"
    28. },
    29. "cur_data":{
    30. "last_time":"2018-03-08T15:10:42.264+08:00",
    31. "bk_cloud_id":[
    32. {
    33. "ref_id":2,
    34. "ref_name":"test connecting area"
    35. }
    36. ],
    37. "create_time":"2018-03-08T14:23:05.05+08:00",
    38. "bk_host_id":1,
    39. "bk_host_innerip":"127.0.0.1",
    40. "bk_import_from":"1"
    41. },
    42. "header":[
    43. {
    44. "bk_property_id":"bk_host_innerip",
    45. "bk_property_name":"内网IP"
    46. },
    47. {
    48. "bk_property_id":"bk_host_outerip",
    49. "bk_property_name":"外网IP"
    50. }
    51. ],
    52. "type":"map"
    53. },
    54. "ext_key":"127.0.0.1",
    55. "op_time":"2018-03-08T03:30:28.056Z",
    56. "inst_id":1
    57. }
    58. ]
    59. }
    60. }
    • output字段说明:
    名称 类型 说明 Description
    result bool 请求成功与否。true:请求成功;false请求失败 request result true or false
    bk_error_code int 错误编码。 0表示success,>0表示失败错误 error code. 0 represent success, >0 represent failure code
    bk_error_msg string 请求失败返回的错误信息 error message from failed request
    data object 请求返回的数据 the data response

    data 字段说明:

    名称 类型 说明 Description
    count int 请求记录条数 the count of record
    info object array record information the information of record

    info 字段说明:

    名称 类型 说明 Description
    bk_supplier_account string 开发商ID supplier account code
    bk_biz_id int 业务ID business ID
    op_type string 操作类型 the type of record
    op_desc string 操作描述 operation description
    op_target string 操作对象 operation target
    operator string 操作者 the man operate it
    content object 对象 操作内容 operate content
    ext_key string 附加信息 ext key
    op_time string 操作时间 operation time
    inst_id int 实例ID instantiation ID

    content 字段说明: content为实际的操作内容