Splunk Search

How do you extract all values for respective fields from multi line event?

twh1
Communicator

I have below event in my log which is output of a single command.

TIMESTAMP=2018-09-11T06:47:56|HOSTNAME=a9tvdb152|Cluster_Resources=CRS_Cluster_resources
NAME=ora.ASMNET1LSNR_ASM.lsnr
TYPE=ora.asm_listener.type
TARGET=ONLINE             , ONLINE             , ONLINE
STATE=ONLINE on a9tvdb151, ONLINE on a9tvdb152, ONLINE on a9tvdb153
NAME=ora.ASMNET2LSNR_ASM.lsnr
TYPE=ora.asm_listener.type
TARGET=ONLINE             , ONLINE             , ONLINE
STATE=ONLINE on a9tvdb151, ONLINE on a9tvdb152, ONLINE on a9tvdb153
NAME=ora.DATA1_DG.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE             , ONLINE             , ONLINE
STATE=ONLINE on a9tvdb151, ONLINE on a9tvdb152, ONLINE on a9tvdb153

I am getting below fields in this event but with only first values not rest.

  • TIMESTAMP
  • NAME
  • TYPE
  • TARGET
  • STATE

I need all value occurrence in respective field.

0 Karma

mayurr98
Super Champion

can you try this?

| makeresults 
 | eval data="TIMESTAMP=2018-09-11T06:47:56|HOSTNAME=a9tvdb152|Cluster_Resources=CRS_Cluster_resources
 NAME=ora.ASMNET1LSNR_ASM.lsnr
 TYPE=ora.asm_listener.type
 TARGET=ONLINE             , ONLINE             , ONLINE
 STATE=ONLINE on a9tvdb151, ONLINE on a9tvdb152, ONLINE on a9tvdb153
 NAME=ora.ASMNET2LSNR_ASM.lsnr
 TYPE=ora.asm_listener.type
 TARGET=ONLINE             , ONLINE             , ONLINE
 STATE=ONLINE on a9tvdb151, ONLINE on a9tvdb152, ONLINE on a9tvdb153
 NAME=ora.DATA1_DG.dg
 TYPE=ora.diskgroup.type
 TARGET=ONLINE             , ONLINE             , ONLINE
 STATE=ONLINE on a9tvdb151, ONLINE on a9tvdb152, ONLINE on a9tvdb153" | rex field=data max_match=0 "NAME\=(?<NAME>.*)\s*TYPE\=(?<Type>.*)\s*TARGET\=(?<TARGET>.*)\s*STATE\=(?<STATE>.*)"
0 Karma

twh1
Communicator

HI @mayurr98 ,

I tried above option and got the result in tablular format. But all data is displayed as single event. Not as multiple row.

0 Karma

Sukisen1981
Champion

are you using regex to extract the values?

0 Karma

twh1
Communicator

@Sukisen1981
As I mentioned, event is output of single command. I am not using regex. I need to extract the field run time.

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

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