Splunk Search

How do i extract this field with regex?

syedabuthahir
Explorer

i want to extract this below event from the _raw event for all the entries in query. Can you please help me on this. 

None, 'Users': [{'Id': '10'}]

 

Thanks in Advance

Labels (1)
0 Karma

manjunathmeti
SplunkTrust
SplunkTrust

Try this:

| rex ",\s(?<interested_field>\'Users\':\s[^,]+),\s"

Sample query:

| makeresults 
| eval _raw="{'OrderUId': 'e99ac189-d8ef-41a2-b6cc-2c8902404c34', 'UserOrder': 'chubuatr9c4f3e6a-c2ea-e511-8053-180373e9b33dleo.yong.lichubu', 'ClientName': 'xxx', 'EndToEndUId': 'chubu', 'DMSId': 'chubu', 'DeployRegion': 'NA', 'EntityEventUId': '', 'CloudPlatform': 'AWS', 'MyClient': 'xx xx', 'OS': 'CentOS', 'FDSEnabled': 'true', 'OrderItems': [{'OrderItemUId': 'e99ac189-d8ef-41a2-b6cc-2c8902404c34', 'ProjectId': 'chubu', 'ProvisionType': 3, 'CreatedBy': 'leo.yong.li', 'CreatedDate': '2021-01-05T14:14:15+08:00', 'ModifiedBy': '', 'ModifiedDate': '', 'ResolvedDate': '', 'ResolvedBy': '', 'Status': 'Placed', 'ProductUId': '9c4f3e6a-c2ea-e511-8053-180373e9b33d', 'VendorName': 'CAM', 'Message': None, 'Users': [{'Id': '10'}], 'Config': [{'Key': 'FDSEnabled', 'Value': 'no'}," 
| rex ",\s(?<interested_field>\'Users\':\s[^,]+),\s"

 

If this reply helps you, an upvote/like would be appreciated.

manjunathmeti
SplunkTrust
SplunkTrust

Provide some sample _raw events and highlight what data/fields exactly want to extract.

0 Karma

syedabuthahir
Explorer

{'OrderUId': 'e99ac189-d8ef-41a2-b6cc-2c8902404c34', 'UserOrder': 'chubuatr9c4f3e6a-c2ea-e511-8053-180373e9b33dleo.yong.lichubu', 'ClientName': 'xxx', 'EndToEndUId': 'chubu', 'DMSId': 'chubu', 'DeployRegion': 'NA', 'EntityEventUId': '', 'CloudPlatform': 'AWS', 'MyClient': 'xx xx', 'OS': 'CentOS', 'FDSEnabled': 'true', 'OrderItems': [{'OrderItemUId': 'e99ac189-d8ef-41a2-b6cc-2c8902404c34', 'ProjectId': 'chubu', 'ProvisionType': 3, 'CreatedBy': 'leo.yong.li', 'CreatedDate': '2021-01-05T14:14:15+08:00', 'ModifiedBy': '', 'ModifiedDate': '', 'ResolvedDate': '', 'ResolvedBy': '', 'Status': 'Placed', 'ProductUId': '9c4f3e6a-c2ea-e511-8053-180373e9b33d', 'VendorName': 'CAM', 'Message': None, 'Users': [{'Id': '10'}], 'Config': [{'Key': 'FDSEnabled', 'Value': 'no'},

Want to extract the green font from the _raw event

 

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...