Graylog2 / graylog2-server

Free and open log management
https://www.graylog.org
Other
7.33k stars 1.05k forks source link

Make the parameter "creation_date" of Create Index Set API optional #4709

Closed suzuki-shunsuke closed 1 year ago

suzuki-shunsuke commented 6 years ago

The parameter "creation_date" of Create Index Set API is required, but I think this should be optional. This value seems to be the time the index set is created, and the time should be decided by the server side.

Expected Behavior

Current Behavior

Response HTTP Status Code: 400 Response Body:

{
  "type": "ApiError",
  "message": "Can not construct instance of org.graylog2.rest.resources.system.indexer.responses.IndexSetSummary, problem: Null creationDate\n at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@39726539; line: 21, column: 5]"
}

Possible Solution

Make the default value of the parameter "creation_date" the datetime when server receives the request.

Steps to Reproduce (for bugs)

Run a Index Set Create API request whose creation_date parameter is not specified. It is convenient to use the API browser.

http://localhost:9000/api/api-browser#!/System/IndexSets/save_post_1

Here is the sample request body.

{
  "title": "Default index set",
  "description": "The Graylog default index set",
  "index_prefix": "sample",
  "shards": 4,
  "replicas": 0,
  "rotation_strategy_class": "org.graylog2.indexer.rotation.strategies.MessageCountRotationStrategy",
  "rotation_strategy": {
    "type": "org.graylog2.indexer.rotation.strategies.MessageCountRotationStrategyConfig",
    "max_docs_per_index": 20000000
  },
  "retention_strategy_class": "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategy",
  "retention_strategy": {
    "type": "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategyConfig",
    "max_number_of_indices": 20
  },
  "index_analyzer": "standard",
  "index_optimization_max_num_segments": 1,
  "index_optimization_disabled": false,
  "writable": true
}

Context

Your Environment

Here is the docker-compose.yml which I use.

---
version: '2'
services:
  # MongoDB: https://hub.docker.com/_/mongo/
  mongodb:
    image: mongo:3
  # Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docker.html
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.6.3
    environment:
      - http.host=0.0.0.0
      - transport.host=localhost
      - network.host=0.0.0.0
      # Disable X-Pack security: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/security-settings.html#general-security-settings
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 2g
  # Graylog: https://hub.docker.com/r/graylog/graylog/
  graylog:
    image: graylog/graylog:2.4.3-1
    environment:
      # CHANGE ME!
      - GRAYLOG_PASSWORD_SECRET=somepasswordpepper
      # Password: admin
      - GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
      - GRAYLOG_WEB_ENDPOINT_URI=http://127.0.0.1:9000/api
    links:
      - mongodb:mongo
      - elasticsearch
    depends_on:
      - mongodb
      - elasticsearch
    ports:
      # Graylog web interface and REST API
      - 9000:9000
      # GELF TCP
      - 12201:12201
      # GELF UDP
      - 12201:12201/udp
hulkk commented 5 years ago

This issue exists in Graylog 3.0.0. Error message is a bit different

{
  "type": "ApiError",
  "message": "Can not construct instance of org.graylog2.rest.resources.system.indexer.responses.IndexSetSummary, problem: Null creationDate\n at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@20da7f5d; line: 22, column: 9]"
}
aba-rechsteiner commented 4 years ago

any update here?

rosaLux161 commented 4 years ago

Same error here. Trying to access api with Python:

{'type': 'ApiError', 'message': 'Cannot construct instance of `org.graylog2.rest.resources.system.indexer.responses.IndexSetSummary`, problem: Null creationDate\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 807]'}

The API documentation describes that the parameter is optional.

Any updates?

ppalanisami commented 2 years ago

Hi, I am a new Open Source Contributor. I would like to work on this issue. Can you please provide more insights on this issue?

jasonrberk commented 2 years ago

STILL happening on GL 4....

rosaLux161 commented 2 years ago

STILL happening on GL 4....

Haha, not the only reason quitting GL.