Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
72 views
in Technique[技术] by (71.8m points)

Celery-Django weblogs Grok Pattern

I'm trying to get the grok pattern for the following web log line:

[2020-12-14 10:44:57,598: INFO/ForkPoolWorker-1] Task celery.chord_unlock[1f93d444-835f-4ff4-b730-915b0f17f9ab] retry: Retry in 1s

and this is the pattern I've got:

%{DATESTAMP:timestamp},%{INT:pid}:s%{DATA:loglevel}%{GREEDYDATA:message}

which simulates this:

{

  "timestamp": [
    "20-12-14 10:44:57"
  ],

  "pid": [
    "598"
  ],

  "loglevel": [
    ""
  ],

  "message": [
    "INFO / ForkPoolWorker-1] Task celery.chord_unlock [1f93d444-835f-4ff4-b730-915b0f17f9ab] retry: Retry in 1s"
  ]

}
question from:https://stackoverflow.com/questions/65935640/celery-django-weblogs-grok-pattern

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I hope this is a better one for you:

%{DATESTAMP:timestamp},%{INT:pid}: %{DATA:loglevel}/%{DATA:worker}] %{GREEDYDATA:message}

build it using grok debugger and cheat-sheet.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...