Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(home): Log monitoring supports json logs #588

Merged
merged 3 commits into from
Aug 8, 2023

Conversation

jsy1001de
Copy link
Collaborator

@jsy1001de jsy1001de commented Aug 7, 2023

Which issue does this PR close?

Closes #

Rationale for this change

What changes are included in this PR?

  1. Log monitoring supports json logs,the parse type must be set to json

example:

{"time":"2023-03-23 16:19:01","level":"INFO","cost":1}
{
  "select": {
    "values": [
      {
        "as": "count",
        "agg": "count"
      },
      {
        "as": "cost_sum",
        "agg": "sum",
        "elect": {
          "type": "refName",
          "refName": {
            "name": "$.cost"
          }
        }
      }
    ]
  },
  "from": {
    "type": "log",
    "log": {
      "path": [
        {
          "type": "path",
          "pattern": "/tmp/1.log"
        }
      ],
      "charset": "utf-8",
      "parse": {
        "type": "json"
      },
      "time": {
        "_doc": "将 type 设置成 processTime 表示使用 '处理时间' 作为时间戳 ",
        "type": "elect",
        "elect": {
          "type": "refName",
          "refName": {
            "name": "$.time"
          }
        },
        "format": "golangLayout",
        "layout": "2006-01-02 15:04:05"
      }
    }
  },
  "where": {},
  "groupBy": {
    "maxKeys": -1,
    "groups": [
      {
        "name": "level",
        "elect": {
          "type": "refName",
          "refName": {
            "name": "$.level"
          }
        }
      }
    ]
  },
  "window": {
    "interval": 5000
  },
  "output": {
    "type": "console"
  },
  "executeRule": {
    "fixedRate": 0
  }
}

Are there any user-facing changes?

How does this change test

Copy link
Collaborator

@masaimu masaimu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jsy1001de jsy1001de merged commit 1252caa into traas-stack:main Aug 8, 2023
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants