# How to print logs in JSON format for enterprise search

**URL:** <https://discuss.elastic.co/t/how-to-print-logs-in-json-format-for-enterprise-search/259455>\
**Category:** Elastic Search\
**Tags:** docker, elastic-app-search\
**Created:** [December 23, 2020, 7:58am UTC](https://discuss.elastic.co/t/how-to-print-logs-in-json-format-for-enterprise-search/259455 "2020-12-23T07:58:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Subhasis\_Dash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/subhasis_dash/32/68827_2.png) [@Subhasis\_Dash](https://discuss.elastic.co/u/Subhasis_Dash)\
**Post date:** [December 23, 2020, 7:58am UTC](https://discuss.elastic.co/t/how-to-print-logs-in-json-format-for-enterprise-search/259455/1 "2020-12-23T07:58:46Z")

</div>

HI,  
I am using the following docker-compose.yml , can some one help on how to modify this to get the enterprise search logs in JSON format

```auto
---
version: '3'
services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
    environment:
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
      - ELASTIC_PASSWORD=changeme
      - xpack.security.enabled=false
      - xpack.security.authc.api_key.enabled=false
      - action.auto_create_index=.ent-search-*-logs-*,-.ent-search-*,-test-.ent-search-*,+*
      - xpack.security.authc.realms.native.local.order=0
    ulimits:
      memlock:
        soft: -1
        hard: -1
    networks: ['stack']

  enterprisesearch:
    image: docker.elastic.co/enterprise-search/enterprise-search:7.9.3
    environment:
    - "ent_search.auth.source=standard"
    - "elasticsearch.username=elastic"
    - "elasticsearch.password=changeme"
    - "elasticsearch.host=http://elasticsearch:9200"
    - "allow_es_settings_modification=true"
    - "secret_management.encryption_keys=[XYZ]"
    - "ENT_SEARCH_DEFAULT_PASSWORD=changeme"
    ports: ['3002:3002']
    networks: ['stack']
    links: ['elasticsearch']
    depends_on: ['elasticsearch']

networks:
  stack: {}

```

Adding screen shot for reference , as you can see the elasticsearch logs are in JSON format but the enterprisesearch logs are not. Any help is greatly appreciated:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/4/f4a1f0058faa0075d5df9dba268a23f5c1f81068.png)

---

<div class="post-metadata">

**Author:** ![ross.bell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ross.bell/32/77559_2.png) [@ross.bell](https://discuss.elastic.co/u/ross.bell)\
**Post date:** [December 23, 2020, 6:19pm UTC](https://discuss.elastic.co/t/how-to-print-logs-in-json-format-for-enterprise-search/259455/2 "2020-12-23T18:19:28Z")

</div>

Hey Subhasis\_Dash,

Can you try adding `- "log_format=json"` in the `services.enterprisesearch.environment` context? So, right after this line: ` - "ENT_SEARCH_DEFAULT_PASSWORD=changeme"`.

Let me know if that works.

Ross

---

<div class="post-metadata">

**Author:** ![Subhasis\_Dash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/subhasis_dash/32/68827_2.png) [@Subhasis\_Dash](https://discuss.elastic.co/u/Subhasis_Dash)\
**Post date:** [December 24, 2020, 7:13am UTC](https://discuss.elastic.co/t/how-to-print-logs-in-json-format-for-enterprise-search/259455/3 "2020-12-24T07:13:20Z")

</div>

Thank you @ross.bell, it works !

---

<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:** [January 21, 2021, 7:13am UTC](https://discuss.elastic.co/t/how-to-print-logs-in-json-format-for-enterprise-search/259455/4 "2021-01-21T07:13:29Z")

</div>

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