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
Champion

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
Champion

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!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...