How to print logs in JSON format for enterprise search

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

---
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:

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

1 Like

Thank you @ross.bell, it works !

1 Like

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