# HTTPJSON input : get only new records

**URL:** <https://discuss.elastic.co/t/httpjson-input-get-only-new-records/319598>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [November 23, 2022, 12:24am UTC](https://discuss.elastic.co/t/httpjson-input-get-only-new-records/319598 "2022-11-23T00:24:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![djesus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djesus/32/113663_2.png) [@djesus](https://discuss.elastic.co/u/djesus)\
**Post date:** [November 23, 2022, 12:24am UTC](https://discuss.elastic.co/t/httpjson-input-get-only-new-records/319598/1 "2022-11-23T00:24:17Z")

</div>

hi everyone!

im trying to get audit logs from a cloud api, the logs on the api are always the same unless there is a new login happening.

while using the httpjson input im always getting all data again, creating multiple duplicate records, which is expected...i've been looking at request.transforms but i cant manage to get it working

```auto
  request.transforms:
    - set:
        target: last_response_body
        value: '[[.last_response.body.id]]'

```

this does nothing on my case... im a bit lost.

i would like to only get new records = newer ID's on the api based on the last response we got from it

example of api records

[  
{  
"id": 4603,  
"time": "2022-08-24T15:11:21.181120-07:00",  
"body": {  
"user": "[xxx@xxx.org](mailto:xxx@xxx.org)",  
"details": "Login succeeded from 1.1.1.1 with identity provider 'something'. Granted privilege 'writelevel: access\_admin' based on OIDC attribute 'custom:write\_level', value 'access\_admin'. Granted privilege 'packetslevel: full\_with\_keys' based on OIDC attribute 'custom:packets\_level', value 'full\_with\_keys'. Granted privilege 'detectionsaccesslevel: full' based on OIDC attribute 'custom:detections\_level', value 'full'.",  
"facility": "OIDC",  
"priority": 6,  
"operation": "Login"  
},  
"occur\_time": 1661379081181  
},  
{  
"id": 4602,  
"time": "2022-08-24T15:10:57.636993-07:00",  
"body": {  
"user": "[xxx@xxx.org](mailto:xxx@xxx.org)",  
"details": "Login succeeded from 1.1.1.1 with identity provider 'something'. Granted privilege 'writelevel: access\_admin' based on OIDC attribute 'custom:write\_level', value 'access\_admin'. Granted privilege 'packetslevel: full\_with\_keys' based on OIDC attribute 'custom:packets\_level', value 'full\_with\_keys'. Granted privilege 'detectionsaccesslevel: full' based on OIDC attribute 'custom:detections\_level', value 'full'.",  
"facility": "OIDC",  
"priority": 6,  
"operation": "Login"  
},  
"occur\_time": 1661379057637  
}  
]

so, after the first run, i would only like to send if record is 4604, and so on (whatever id was last, since the last time filebeat went out to get the api records) i believe i should also use the cursor option? ...

appreciate if anyone could lend a hand, would be highly appreciated!!

Daniel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 21, 2022, 2:24am UTC](https://discuss.elastic.co/t/httpjson-input-get-only-new-records/319598/2 "2022-12-21T02:24:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
