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 the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...