Splunk Search

How to write regex to extract a field from a log?

Bhuavana
Explorer

Hi,

I have a below log :

INFO com.wu.channelservices.businesslogic.impl.ChannelServicesLogicImpl S:METHOD_NAME=GwpCreateSession : WebAppSessionId= : ChannelSessionId= : ClientIp=027050022090 : - databases.database[0].info.name: CAN_STATE_LIST

From above message i need to extract the value of database name[CAN_STATE_LIST] alone from below full text :

databases.database[0].info.name: CAN_STATE_LIST

Could you please share me the corresponding regex for the same?

Tags (2)
0 Karma

ulrich_track
Path Finder

You can find it out by copying that section in regex101.com and playing around. I found this:

During searchtime:

| rex "name:\s(?<DBname>\S+)"

Or in the field-extractor

(?m)name:\s(?<FIELDNAME>\S+)
0 Karma

Ayn
Legend

This should be possible to extract using the Interactive Field Extractor.

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

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 ...