Splunk Search

Custom calculated Field-Extraction

meenal901
Communicator

Hi,

I have a data of the form:
Source,Date,Time
Source1,20120904,000000
Source3,20120904,000000
Source1,20120904,000000
Source4,20120904,000000
Source2,20120904,000000
Source3,20120904,000000
Source4,20120904,000000
Source2,20120904,000000

When i upload this file, i want to sort is based on column "Source" and add a custom column called "Unique_ID" which will have value of time+1 for same Source. Effectively, the data should look like:

Source,Date,Time
Source1,20120904,000001
Source1,20120904,000002
Source2,20120904,000001
Source2,20120904,000002
Source3,20120904,000001
Source3,20120904,000002
Source4,20120904,000001
Source4,20120904,000002

What regex should be written to props.conf and transforms.conf to do the same?

Tags (1)
0 Karma
1 Solution

meenal901
Communicator

I resolved this by using eventstats at search time. Assigned a unique ID at run-time.

View solution in original post

0 Karma

meenal901
Communicator

I resolved this by using eventstats at search time. Assigned a unique ID at run-time.

0 Karma

Ayn
Legend

You could use the _indextime field to check when events were indexed, and then use that (if I understood your scenario correctly).

0 Karma

meenal901
Communicator

Yes i understand the limitation of regex. The data is in a bucket of 15 minutes. I need a way to co-relate events of a source with another. A unique key at the time of adding data. But couldn't find.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Regular expressions can neither sort nor count nor do maths. For that you need a more powerful language, such as a scripted input that does this work for you.

What's the ultimate goal you're trying to achieve here?

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!

Quantify Your Splunk Investment Impact: Introducing Savings Metrics to Value Insights

Building on the foundation established in our initial Value Insights releases, we are introducing the Savings ...

Event Series: Telemetry Pipeline Management

Balancing Scale and Spend: Gaining Control Over High-Volume Metrics in Splunk Observability Cloud As ...

Kick the Tires Before You Commit: A Hands-On Tour of the Splunk Observability Cloud ...

Evaluating an enterprise observability platform usually goes like this: fill out a form, get a free trial with ...