Getting Data In

Dataset Constraint

RdomSplunkUser7
Explorer

In the documentation <https://help.splunk.com/en/splunk-enterprise/manage-knowledge-objects/knowledge-management-manual/9....>, there is written:

Dataset constraints determine the first part of the search through

  • Simple search filters (Root event datasets and all child datasets).
  • Complex search strings (Root search datasets).
  • transaction definitions (Root transaction datasets).

In my new data model I try to make a new dataset constraint which will try to select only unique field  eventId.

EventId is a number, ie.123456.

My goal is to drop duplicated log lines. Is it possible to define this kind of data set constraint?

Labels (1)
0 Karma
1 Solution

PrewinThomas
Motivator

@RdomSplunkUser7 

You may try to use a "Root search dataset."

When you create your data model, instead of starting with a "Root Event" dataset , choose to create a "Root Search" dataset.
In the "Search String" field for this Root Search dataset, put your base search query followed by the dedup command
Eg:
index=test_logs sourcetype="test_logs_st" [your base filters] | dedup eventId

This might be able to built datamodel only from events with unique eventId

Regards,
Prewin
Splunk Enthusiast | Always happy to help! If this answer helped you, please consider marking it as the solution or giving a kudos/Karma. Thanks!

View solution in original post

PrewinThomas
Motivator

@RdomSplunkUser7 

You may try to use a "Root search dataset."

When you create your data model, instead of starting with a "Root Event" dataset , choose to create a "Root Search" dataset.
In the "Search String" field for this Root Search dataset, put your base search query followed by the dedup command
Eg:
index=test_logs sourcetype="test_logs_st" [your base filters] | dedup eventId

This might be able to built datamodel only from events with unique eventId

Regards,
Prewin
Splunk Enthusiast | Always happy to help! If this answer helped you, please consider marking it as the solution or giving a kudos/Karma. Thanks!

marnall
Motivator

I don't think it is possible to constrain a dataset to "only intake 1 event containing each value of EventId and then exclude the rest of the events with the same EventId value." This would require the dataset to check against a list of already-included EventId values for every new event it intakes.

It would be better to do this in another way. Ideally you could change the events themselves so that they only have one event per EventID, but there are other tricks you could try, like making a search that makes summary-indexed events once per EventID while excluding all EventIDs that already exist in the destination index. Then you could set the datamodel+dataset to include events from the index of summary-indexed events.

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...