new feature: JSON output schema #103
Replies: 6 comments 10 replies
-
| 
         /cc. @mloskot  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         For File and Process can we include FileName or ProcessName in addition to the Logline. This is relevant for File since we currently support monitoring multiple files at the same time, I imagine may also be relevant for process should we ever go with multiple child process support  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         Overall the idea looks good to me. For   | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         Any thoughts on making it ECS compatible? https://www.elastic.co/guide/en/ecs/current/index.html  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         The WIP implementation is here, pending some e2e testing, reviews and a few TODOs - #110  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         Closing this discussion. feature is now available here  | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Preamble
The aim is to come up with a standard JSON output schema as the default output for the LogMonitor tool v2 (due to the breaking changes). This will make it easier for log analysis tools. In Azure Monitor for instance, you can use functions like parse_json the LogEntry column and extract specific data points that you can analyze on.
In this document, we would like to propose a top-level schema for the log entries. This is top-level because, in the inner JSON entries, especially for ETW logs, the (custom) fields will vary between different ETW providers.
Will be also good to note that we will be using NDJSON (Newline Delimited JSON) for the log entry since the logs are streams that should be processed one record at a time.
Schema
Here is our proposed schema for JSON outputs for the various log sources:
{ "Source": "File|Process|ETW|EventLog", "LogEntry": { // diffent per source }, "SchemaVersion": "" } // LogEntry - File { "Logline": "...", "FileName": "..." } // LogEntry - Process { "Logline": "...", "ProcessName": "...", "ProcessId": xxx } // LogEntry - EventLog { "Time": "", "Channel": "", "Level": "Error|Information", "EventId": "", "Message": "" } // LogEntry - ETW { "Time": "", "ProviderId": "", "ProviderName": "", "Execution": { "ProcessId": <int>, "ThreadId": <int> }, "Level": "Error|Information", "Keyword": "", "EventId": <int>, "EventData": { // varies depending on provider } }Examples
EventLog
{ "Source": "EventLog", "LogEntry": { "Time": "2022-11-30T16:39:18.000Z", "Level": "Error", "EventId": 701, "Message": "Task Scheduler service failed to start Task Compatibility module. Tasks may not be able to register on previous Window versions. Additional Data: Error Value: 2147942526." }, "SchemaVersion": "1.0.0" }ETW
Example 1:
{ "Source": "ETW", "LogEntry": { "Time": "2022-11-30T09:40:22.000Z", "ProviderId": "{7E8AD27F-B271-4EA2-A783-A47BDE29143B}", "ProviderName": "Microsoft-Windows-IIS-Logging", "DecodingSource": "DecodingSourceXMLFile", "Execution": { "ProcessId": 8300, "ThreadId": 4440 }, "Level": "Information", "Keyword": "0x8000000000000000", "EventId": 6200, "EventData": { "EnabledFieldsFlags": 2478079, "date": "2022-11-30", "time": "09:40:27", "c-ip": "10.224.0.4", "cs-username": "-", "s-sitename": "W3SVC1", "cs-computername": "iislogmonitor-847fbf7766-rqr4b", "s-ip": "10.224.0.171", "cs-method": "GET", "cs-uri-stem": "/.env", "cs-uri-query": "-", "sc-status": 404, "sc-win32-status": 2, "sc-bytes": 1383, "sc-bytes": 232, "time-taken": 89, "s-port": 80, "csUser-Agent": "Mozilla/5.0+(X11 +Linux+x86_64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/81.0.4044.129+Safari/537.36", "csCookie": "-", "csReferer": "-", "cs-version": "-", "cs-host": "-", "sc-substatus": 0, "CustomFields": "null" } }, "SchemaVersion": "1.0.0" }Example 2:
{ "Source": "ETW", "LogEntry": { "Time": "2022-12-06T13:40:28.000Z", "ProviderId": "{DAA6A96B-F3E7-4D4D-A0D6-31A350E6A445}", "ProviderName": "Microsoft-Windows-WLAN-Driver", "DecodingSource": "DecodingSourceXMLFile", "Execution": { "ProcessId": 13804, "ThreadId": 13900 }, "Level": "Information", "Keyword": "0x8000000000000001", "EventId": 0, "EventData": { "FrameUniqueID": 5434658, "PortNumber": 0, "TID": 0, "PeerID": 0, "PayloadLength": 1286, "QueueLength": 0, "QueueState": "false", "CustomData1": 24, "CustomData2": 0, "CustomData3": 0 } }, "SchemaVersion": "1.0.0" }File Log
{ "Source": "File", "LogEntry": { "Logline": "2022-12-01 23:14:16 10.224.0.163 HEAD /memberadmin.cfm - 80 - 10.224.0.149 Mozilla/5.0+(compatible;+Nmap+Scripting+Engine;+https://nmap.org/book/nse.html) - 404 0 2 95", }, "SchemaVersion": "1.0.0" }Process Log
{ "Source": "Process", "LogEntry": { "Logline": "Name: C:\\ProgramData\\ssh", "ProcessExe": "C:\\LogMonitor\\log_writer.exe" }, "SchemaVersion": "1.0.0" }Beta Was this translation helpful? Give feedback.
All reactions