# Need Help to extract custom log data using gork

**URL:** <https://discuss.elastic.co/t/need-help-to-extract-custom-log-data-using-gork/318350>\
**Category:** Logstash\
**Created:** [November 7, 2022, 4:00pm UTC](https://discuss.elastic.co/t/need-help-to-extract-custom-log-data-using-gork/318350 "2022-11-07T16:00:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ipasa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ipasa/32/97083_2.png) [@ipasa](https://discuss.elastic.co/u/ipasa)\
**Post date:** [November 7, 2022, 4:00pm UTC](https://discuss.elastic.co/t/need-help-to-extract-custom-log-data-using-gork/318350/1 "2022-11-07T16:00:43Z")

</div>

We want to extract some custom logs like this,

```auto
[2022-10-19 07:45:21] test_site.INFO: REQUEST: [{"username":"6HANT","password":"u5469!230","grant_type":"password"},{"Content-Type":"application/json"},"https://abc.SD.com:8080/retin/api/token","POST"] []

[2022-10-19 07:45:21] test_site.INFO: RESPONSE:{"access_token":"eyJhbGciOiJIIkpXVCJ9.eyJ1bmlxdWE2NjYx2NjE2ODUy1NTIxfQ.1rvspnSrqeW3w9vNoZmWqEcxW156w","token_type":"bearer","expires_in":"5"} [] []

[2022-10-19 07:45:21] test_site.INFO: REQUEST: [{"RequestData":{"MobeNum":"+880657567324"},"RequestId":"1660","ChannelId":"ShYZ"},{"Content-Type":"application/json","Authorization":"Bearer eyJhbVCJ9.eyJ1bmlx1MjEsMSwiaWF0IjoTIxfQ.1rvx2x0ZLbW156w"},"https://dev.abc.com:8080/refin/api/acctpen/genep","POST"] []

```

We are interested only json data as separated fields and url.

any one have any clue please help me. Thank's in advance.

---

<div class="post-metadata">

**Author:** ![grumo35](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grumo35/32/59451_2.png) [@grumo35](https://discuss.elastic.co/u/grumo35)\
**Post date:** [November 7, 2022, 4:20pm UTC](https://discuss.elastic.co/t/need-help-to-extract-custom-log-data-using-gork/318350/2 "2022-11-07T16:20:43Z")

</div>

Hi,

First you can use the grok debugger in Kibana dev tools

`https://KIBANA:5601/app/dev_tools#/grokdebugger`

You can put your data into the "sample data" form, when we look at your data we can see that there is weird JSON arrays

Here is a very basic one that will help you to get further

(?(.+?]))%{SPACE}(?(\w+\S+))%{SPACE}(?(\w+\S+))%{SPACE}(?\<json\_message\>(.+))

( Really dirty regex i dont really took the time )

To help you more [https://regex101.com/](https://regex101.com/) And try tit yourself !

---

<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 5, 2022, 4:21pm UTC](https://discuss.elastic.co/t/need-help-to-extract-custom-log-data-using-gork/318350/3 "2022-12-05T16:21:03Z")

</div>

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