Splunk Search

extract multi lines fields

lgmnemesis
Explorer

We are logging the following application network statistics. I want to be able to index the data into splunk so we can generate reports on it.

The First line consists of the following fields:
timestamp, site name, remote server name , local server name

Other lines of the same record consists of the following fields:
statistic name : message type : origin Node : statistic Value

This is the actual log:

1386704158913 SITE-A,remoteServer1,localhost
receivedMessages:AAA:NODE1:10
receivedMessages:BBB:NODE1:10
sentMessages:CCC:NODE2:10
discMessages:AAA:NODE1:1
discMessages:BBB:NODE2:1

1386704158913 SITE-A,remoteServer2,localhost2
receivedMessages:FFF:NODE1:10
receivedMessages:GGG:NODE1:10
sentMessages:HHH:NODE2:10
discMessages:FFF:NODE1:1
discMessages:III:NODE2:1

Is there a way to extract all the fields above from that log format?

Thanks a lot.

Tags (2)
0 Karma

linu1988
Champion

Use Regext to extract the time, then MVEXPAND then you will be able to have the correlation. Then make the extractions.

0 Karma

asimagu
Builder

You can easily do that by adjusting the line breaking in props.conf

Have a play with regular expressions and the options under "Attributes that are available only when SHOULD_LINEMERGE is set to true" in

http://docs.splunk.com/Documentation/Splunk/6.0/Data/Indexmulti-lineevents

0 Karma

kristian_kolb
Ultra Champion

No, you should not break them into single-line events, for the exact reasons that you mention. My question was if you had succeeded in creating the (multi-line) events correctly in splunk.

0 Karma

lgmnemesis
Explorer

If i break the log/lines into individual events, wont i loos the correlation between the first line (which consists of the event time stamp and other shared fields) and the other sub lines?

0 Karma

kristian_kolb
Ultra Champion

Any problems with breaking the log into indvidual events? Or is it only regarding the field extraction?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Skip the Awkward Silence: Have a .conf-ersation at .conf26

Picture this. You arrive at .conf26 already having your socializing and networking plans mapped out. No ...

Rethinking Zero Trust: From Product Purchases to Logical Control Evidence

Implementing Zero Trust (ZT) across complex environments often falters at the very beginning due to a ...