Grok Parsing

Validate log samples

Parse slog samples using provided Grok rules and returns the extracted fields and which rule matched.

post/v1/grok/parse/batch

Request

  • Base URL
    https://docs.grepr.ai (the document declares no server; this is the origin it was published from)
  • Auth
    • API key in header GREPR-API-KEY
    • or OpenID Connect (https://grepr-prod.us.auth0.com/.well-known/openid-configuration)

Request body

logSamplesstring[] required

Log sample to parse using the provided Grok rules.

Example request

{
  "grokParser": {
    "grokHelperRules": [
      "user %{word:user.name} id:%{integer:user.id}",
      "connection connected on %{date(\"MM/dd/yyyy\"):connect_date}",
      "server on server %{notSpace:server.name} in %{notSpace:server.env}"
    ],
    "grokParsingRules": [
      "MyParsingRule %{user} %{connection} %{server}"
    ],
    "name": "operation_name",
    "predicate": {
      "query": "service:grepr-service-1"
    }
  },
  "logSamples": [
    "john id:12345 connected on 11/08/2017 on server XYZ in production"
  ]
}

Response

Log message parsed successfully.

Example response

{
  "results": [
    {
      "attributes": {
        "connect_date": "11/08/2017",
        "server": {
          "env": "production",
          "name": "XYZ"
        },
        "user": {
          "id": 12345,
          "name": "john"
        }
      },
      "tags": {
        "tag1": [
          "value1",
          "value2"
        ],
        "tag2": [
          "value3"
        ]
      },
      "topLevelFields": {
        "eventTimestamp": "13201984190509",
        "severity": "9"
      }
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.