Search code examples
logstashelastic-stacklogstash-grok

GROk for OASIS logs


I want to create a custom GROK for OASIS logs.

2019-10-29 00:36:53Z|User -User trying to login from desktop oasis screen|Cart -|Level -INFO|Severity -Information|Class -oaCheckOut.aspx.vb|Function -Button1_Click : oaCheckOut|UserID: 261343 Cart_ID: 8050513 - Start :  Validate K12PunchinGuest mandatory fields execution

The GROK i started with

%{TIMESTAMP_ISO8601:timestamp}\|%{GREEDYDATA:user}\|%{DATA}%{SPACE}\-%{DATA:Level}

My output so far.

{
  "timestamp": [
    [
      "2019-10-29 00:36:53Z"
    ]
  ],
  "user": [
    [
      "User -User trying to login from desktop oasis screen|Cart -|Level -INFO|Severity -Information|Class -oaCheckOut.aspx.vb|Function -Button1_Click : oaCheckOut"
    ]
  ],
  "Level": [
    [
      ""
    ]
  ]
}

Here, Im not able to split the User, level and severity separately.

Whats the best way to achieve what I expect? What is the right GROK? Kindly help me out.


Solution

  • Please try below grok,

    %{TIMESTAMP_ISO8601:timestamp}\|(?:User -%{GREEDYDATA:User})\|(?:Cart -%{GREEDYDATA:Cart})\|(?:Level -%{GREEDYDATA:Level})\|(?:Severity -%{GREEDYDATA:Severity})\|(?:Class -%{GREEDYDATA:Class})\|(?:Function -%{GREEDYDATA:Function})\|(?:UserID: %{BASE10NUM:UserID})\s(?:Cart_ID: %{BASE10NUM:Cart_ID})%{GREEDYDATA}