Splunk Search

Parsing kaspersky syslog events

martaBenedetti
Path Finder

Hi community,

I need help in parsing events containing not pure json.

This is the raw event:

 

May 28 15:00:15 sd960evo ESS|2.1.0.0 {"User":"SD960EVO\\WinCash","ObjectName":"C:\\PROGRAM FILES\\NCR\\UAHELPER\\XFSTOOL.EXE","Sha256":"6E3B72786B24A85BA657D8298783402DA5237A864ADE989B7B013DEFE65BEDCF","CmdLine":"\"C:\\Program Files\\NCR\\UAHelper\\XFSTool.exe\" \"C:\\Program Files\\NCR APTRA\\Unified Agent\\WS\\bin\\FileUpload\" PIN30\u0000","ParentName":"C:\\Program Files\\NCR\\UAHelper\\UAHelperService.exe\u0000","ProductName":"","FileVersion":"0.0.0.0","EnforcedPolicy":"Deny","DefaultPolicy":"Deny","MatchedRules":"","Issuer":"","Thumbprint":"","Valid":"No","DefaultDeny":"Yes","ActionMask":"-2147483390"}\r\n

 

 

This is my props.conf 

 

[kaspersky:syslog]
TIME_PREFIX             = ^
TIME_FORMAT             = %b %d %T

EXTRACT-device          = \w+\s+\d+\s+\d+\:\d+\:\d+\s+(?<device>[^\s]*)\s+.*
EXTRACT-app             = \w+\s+\d+\s+\d+\:\d+\:\d+\s+\S+\s(?<app>[^\s]*)\s+.*

REPORT-json = report-json,report-json-kv

 

 

This is my transforms.conf file

 

[report-json]
# This will get the json payload from the logs.
REGEX = (?P<json1>{.+})

# Manually extract JSON key-value
[report-json-kv]
REGEX = \"(\w+)\":[\s]*\"([^\,\}\"]+)
FORMAT = $1::$2
MV_ADD = true

 

 

I've tried regex to extract device, app, json1 at search time with rex command and it's working fine.

Do you have any ideas?

Do you have better solution to parse this log?

 

Thank you very much

Labels (4)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Try extracting device and app in the same regex.

EXTRACT-deviceApp             = \w+\s+\d+\s+\d+\:\d+\:\d+\s+(?<device>\S+)\s(?<app>[^\s]*)\s

I don't see the need for the report-json transform.

This transform should handle the key-value parsing.

[report-json-kv]
REGEX = "(\w+)":\s*"((?:[^"\\]|\\.)*)"
FORMAT = $1::$2
MV_ADD = true
---
If this reply helps you, Karma would be appreciated.

View solution in original post

martaBenedetti
Path Finder

Thank you very much, that worked perfectly fine.

I was able to reach the same result also using SEDCMD.

Thank you again!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try extracting device and app in the same regex.

EXTRACT-deviceApp             = \w+\s+\d+\s+\d+\:\d+\:\d+\s+(?<device>\S+)\s(?<app>[^\s]*)\s

I don't see the need for the report-json transform.

This transform should handle the key-value parsing.

[report-json-kv]
REGEX = "(\w+)":\s*"((?:[^"\\]|\\.)*)"
FORMAT = $1::$2
MV_ADD = true
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...