Splunk Search

extract multiple values from fields in same event

kannu
Communicator

Hello team ,

 

I am having one event in which single field have multiple value like provided below:

 

{"body":{"records": [{ "category": "AzureFirewallNetworkRule", "time": "2021-04-26T13:13:37.0631470Z", "resourceId": "/SUBSCRIPTIONS/**********-*****-****-**/RESOURCEGROUPS/C-ABS-IT-SS-PROD-UKS-RG/PROVIDERS/MICROSOFT.NETWORK/AZUREFIREWALLS/C-ABS-IT-SS-PROD-UKS-FIREWALL", "operationName": "AzureFirewallNetworkRuleLog", "properties": {"msg":"TCP request from 10.119.252.16:64967 to 54.83.8.19:54443. Action: Deny"}},{ "category": "AzureFirewallNetworkRule", "time": "2021-04-26T13:13:37.4217670Z", "resourceId": "/SUBSCRIPTIONS/**********-*****-****-**/RESOURCEGROUPS/C-ABS-IT-SS-PROD-UKS-RG/PROVIDERS/MICROSOFT.NETWORK/AZUREFIREWALLS/C-ABS-IT-SS-PROD-UKS-FIREWALL", "operationName": "AzureFirewallNetworkRuleLog", "properties": {"msg":"TCP request from 10.119.34.12:62142 to 131.100.0.201:5938. Action: Deny"}},{ "category": "AzureFirewallNetworkRule", "time": "2021-04-26T13:13:37.9262290Z", "resourceId": "/SUBSCRIPTIONS/**********-*****-****-**/RESOURCEGROUPS/C-ABS-IT-SS-PROD-UKS-RG/PROVIDERS/MICROSOFT.NETWORK/AZUREFIREWALLS/C-ABS-IT-SS-PROD-UKS-FIREWALL", "operationName": "AzureFirewallNetworkRuleLog", "properties": {"msg":"TCP request from 10.119.252.196:13973 to 40.79.154.87:443. Action: Allow"}}

Above is one single event

from which i want to extract src ip and dest ip 

for example 10.119.252.16 is src ip and 54.83.8.19 is dest ip , I want to extract all from backend i dont wana use  rex max_match=0 .

 

Please let me know how can i extract all from backend .

 

Thanks

Kannu

Labels (1)
0 Karma
1 Solution

kannu
Communicator

Well , I have figured out the answer of my problem ,

Which is  first I have extracted the inner json , from main json event , then i have used props.conf to index them using seprate event in that way splunk is taking all field with separate events   .

 

[azure]
LINE_BREAKER=((?<=\}),(?=\{)|[\r\n]+)
TRUNCATE = 0
SHOULD_LINEMERGE = false
SEDCMD-remove_prefix=s/{"body":{"records":.?\[//g
SEDCMD-remove_suffix=s/\]}.*}//g

View solution in original post

kannu
Communicator

Well , I have figured out the answer of my problem ,

Which is  first I have extracted the inner json , from main json event , then i have used props.conf to index them using seprate event in that way splunk is taking all field with separate events   .

 

[azure]
LINE_BREAKER=((?<=\}),(?=\{)|[\r\n]+)
TRUNCATE = 0
SHOULD_LINEMERGE = false
SEDCMD-remove_prefix=s/{"body":{"records":.?\[//g
SEDCMD-remove_suffix=s/\]}.*}//g

ITWhisperer
SplunkTrust
SplunkTrust

When you say you want to "extract all from backend", do you mean you want to know how to extracted them at indexing time rather than search time?

0 Karma

kannu
Communicator

@ITWhisperer  Yes index time

0 Karma
Get Updates on the Splunk Community!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...