# How to format the grok pattern parsed field value in a new line based on timestamp?

**URL:** <https://discuss.elastic.co/t/how-to-format-the-grok-pattern-parsed-field-value-in-a-new-line-based-on-timestamp/335460>\
**Category:** Logstash\
**Created:** [June 7, 2023, 6:15pm UTC](https://discuss.elastic.co/t/how-to-format-the-grok-pattern-parsed-field-value-in-a-new-line-based-on-timestamp/335460 "2023-06-07T18:15:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhisheksa](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@abhisheksa](https://discuss.elastic.co/u/abhisheksa)\
**Post date:** [June 7, 2023, 6:15pm UTC](https://discuss.elastic.co/t/how-to-format-the-grok-pattern-parsed-field-value-in-a-new-line-based-on-timestamp/335460/1 "2023-06-07T18:15:42Z")

</div>

I have this log message which is filtered using grok pattern. Entire message gets displayed in a single line in the filtered output.

```auto

{
    "message": [
    "Calling com.portal.ws.service.GvpV2Service@2ad03f20 method createIpVpnAccess\n[2023-02-24T11:11:27.863+0100] [] [\u001b[1;93mWARNING\u001b[0m] [] [\u001b[1;94morg.eclipse.persistence.session./file:/tmp/payaramicro-rt12637138685337820354tmp/applications/ROOT/WEB-INF/classes/_IPConnectionPU\u001b[0m] [tid: _ThreadID=71 _ThreadName=http-thread-pool::http-listener(1)] [timeMillis: 1677233487863] [levelValue: 900] [[\n \nLocal Exception Stack: \nException [EclipseLink-4002] (Eclipse Persistence Services - 2.7.4.payara-p2): org.eclipse.persistence.exceptions.DatabaseException\nInternal Exception: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '2023022411112701071' for key 'PRIMARY'\nError Code: 1062\nCall: INSERT INTO orders (id, account_origin, action, exitCode, message, module, orderid_extern, retries, lineid, ... 191 more\n]]\n\n[2023-02-24T11:11:27.865+0100] [] [\u001b[1;93mWARNING\u001b[0m] [AS-EJB-00056] [\u001b[1;94mjavax.enterprise.ejb.container\u001b[0m] [tid: _ThreadID=71 _ThreadName=http-thread-pool::http-listener(1)] [timeMillis: 1677233487865] [levelValue: 900] A system exception occurred during an invocation on EJB OrdersFacade, method: public void com.gvalportal.dao.OrdersFacade.persistNewOrder(com.gvalportal.workflow.model.WorkflowPass)\n\n[2023-02-24T11:11:27.866+0100] [] [\u001b[1;93mWARNING\u001b[0m] [AS-EJB-00056] [\u001b[1;94mjavax.enterprise.ejb.container\u001b[0m] [tid: _ThreadID=71 _ThreadName=http-thread-pool::http-listener(1)] [timeMillis: 1677233487866] [levelValue: 900] A system exception occurred during an invocation on EJB WorkflowCreateIpVpnAccess, method: public com.gvalportal.workflow.model.BaseResponseType com.gvalportal.workflow.ipvpn.create.wbapppoe.WorkflowCreateIpVpnAccess.processCall(com.portal.workflow.model.WorkflowPass,com.portal.workflow.model.BaseRequestType)\n\n"
}

```

What should I change in my grok pattern to display this message in a new line in the same field based on the timestamp string like below?

```auto
{
"message": [
    "Calling com.portal.ws.service.GvpV2Service@2ad03f20 method createIpVpnAccess\n
    
    [2023-02-24T11:11:27.863+0100] [] [\u001b[1;93mWARNING\u001b[0m] [] [\u001b[1;94morg.eclipse.persistence.session./file:/tmp/payaramicro-rt12637138685337820354tmp/applications/ROOT/WEB-INF/classes/_IPConnectionPU\u001b[0m] [tid: _ThreadID=71 _ThreadName=http-thread-pool::http-listener(1)] [timeMillis: 1677233487863] [levelValue: 900] [[\n \nLocal Exception Stack: \nException [EclipseLink-4002] (Eclipse Persistence Services - 2.7.4.payara-p2): org.eclipse.persistence.exceptions.DatabaseException\nInternal Exception: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '2023022411112701071' for key 'PRIMARY'\nError Code: 1062\nCall: INSERT INTO orders (id, account_origin, action, exitCode, message, module, orderid_extern, retries, lineid, ... 191 more\n]]\n\n
    
    [2023-02-24T11:11:27.865+0100] [] [\u001b[1;93mWARNING\u001b[0m] [AS-EJB-00056] [\u001b[1;94mjavax.enterprise.ejb.container\u001b[0m] [tid: _ThreadID=71 _ThreadName=http-thread-pool::http-listener(1)] [timeMillis: 1677233487865] [levelValue: 900] A system exception occurred during an invocation on EJB OrdersFacade, method: public void com.gvalportal.dao.OrdersFacade.persistNewOrder(com.portal.workflow.model.WorkflowPass)\n\n
    
    [2023-02-24T11:11:27.866+0100] [] [\u001b[1;93mWARNING\u001b[0m] [AS-EJB-00056] [\u001b[1;94mjavax.enterprise.ejb.container\u001b[0m] [tid: _ThreadID=71 _ThreadName=http-thread-pool::http-listener(1)] [timeMillis: 1677233487866] [levelValue: 900] A system exception occurred during an invocation on EJB WorkflowCreateIpVpnAccess, method: public com.gvalportal.workflow.model.BaseResponseType com.gvalportal.workflow.ipvpn.create.wbapppoe.WorkflowCreateIpVpnAccess.processCall(com.portal.workflow.model.WorkflowPass,com.portal.workflow.model.BaseRequestType)\n\n"
  ]
}

```

This is the grok pattern I am using:

```auto
"message" => "%{GREEDYDATA:message}"

```

---

<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:** [July 5, 2023, 6:16pm UTC](https://discuss.elastic.co/t/how-to-format-the-grok-pattern-parsed-field-value-in-a-new-line-based-on-timestamp/335460/2 "2023-07-05T18:16:40Z")

</div>

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