Getting Data In

Adding line number to line breaked events

FrankSPL
Path Finder

I'n trying to index complete Cisco switch configuration files. A snipped of such an output look like this:

version 15.2
service timestamps debug datetime msec localtime
service timestamps log datetime msec localtime
no service dhcp
!
hostname DUMMYHOST
!
boot-start-marker
boot-end-marker
!
logging buffered 32000 informational
no logging console
enable secret 5 xyzxyzxyz
!
username enguser secret 5 xyzxyzxyz
username wuguser secret 5 xyzxyzxyz
aaa new-model

..

!
interface GigabitEthernet0/1
description TEXT1
switchport access vlan 123
switchport mode access
switchport nonegotiate

!
interface GigabitEthernet0/2
description TEXT2
switchport access vlan 222
switchport mode access
switchport nonegotiate

Because I wanted to search later on per interface I breaked the files at the ! into events using:
SHOULD_LINEMERGE=true
BREAK_ONLY_BEFORE=^!

As this works OK, and I can do my searches, there is no way I can show the entire configuration file in its original order.
Because the config file does not contain any timestamps I use:
DATETIME_CONFIG=CURRENT

All events now have the same timestamp. There is no way to sort in back in original order.

Is there any (easy) way to solve this?
Could it be possible to add line number to each event or other meta data to sort it later on?

Tags (1)
0 Karma

yannK
Splunk Employee
Splunk Employee

The answer is no, for the index time.
all the events will have almost the same indextime and _time, therefore the original order will be lost once cut in pieces.

if you want to get the whole configuration in a single event (SHOULD_LINEMERGE=false and MAX_EVENTS=thelongestconfigfilelength ) you could eventually try to break it later in multiple pieces at search time.

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!

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...