Knowledge Management

How to tag as datamodel attribute?

PickleRick
SplunkTrust
SplunkTrust

I'm confused a bit. I use CIM datamodels.

The "tag" field is both a filter for choosing events applicable to a particular datamodel and is an attribute within the datasets.

My datamodel is accelerated.

When I do a simple

| from datamodel:Authentication.Failed_Authentication 

I get events with some fields selected (in fast mode) - I assume that those are fields correspoding to the dataset-defined fields.

What's most important for me here is that the "tag" field is populated as with any normal search.

But when I do

 | tstats summariesonly=t dc(Authentication.tag) as tag where nodename=Authentication.Failed_Authentication by Authentication.app Authentication.src 

 I get zero count for dc(Authentication.tag).

It would suggest that the tags are not indexed . All other fields that I tried (like src, dest, user and so on) seem to be indexed OK and I'm able to tstats for them but the tag field is not. Is it treated somehow differently? Or is it because tag is multivalued?

Labels (1)
Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @PickleRick ,

the tag field is mandatory in the scheduled searches to populate Data Models and it's one of the most important fields to define a Data Model, but it isn't a field present by default in Data Models (don't ask me why!).

For this reason your search fails.

If you need tag as field of a data Model, you can customize your Data Model adding the tag field, then you can use it.

Ciao.

Giuseppe

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Ha!

The thing is that it is a field within the datamodel.

https://docs.splunk.com/Documentation/CIM/5.0.1/User/Authentication

If it wasn't, I wouldn't be asking about it 😉

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @PickleRick,

probably is a new in CIM 5.x because I used ES in december and I had to manually add tag field to all Data Models!

Ciao.

Giuseppe

0 Karma

smurf
Communicator

I tried it today with the latest CIM version and I had it populated. Just as OP had in the query dc(Authentication.tag) worked fine. 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Hmm... it's interesting. Might that mean that the fields are not getting populated if the app was updated while the acceleration was already on? (I don't know if it was so - it's customer's environment. Just guessing.)

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Replying to myself - no, it's not that. I enabled acceleration this morning on my lab system.

The Authentication datamodel does have the tag field (the CIM app version is 4.18.0.

| tstats summariesonly=t dc(Authentication.tag) as tag count from datamodel=Authentication where
nodename=Authentication.Failed_Authentication

Shows 0 tags and 318 count.

I'm lost.

0 Karma

smurf
Communicator

Try checking datamodels.conf for tags_whitelist.

According to docs:

* Only the tag fields identified in this allow list (and the event types tagged
  by them) are loaded when you perform searches with this data model.

 

They are defined as default in CIM's DMs but maybe you are rewriting it in you local conf?

PickleRick
SplunkTrust
SplunkTrust

Nice find! Thanks. That might be it.

0 Karma

smurf
Communicator

Hi,

when searching through accelerated data models with tstats you need to specify FROM.

This should work with your query:

 | tstats summariesonly=t dc(Authentication.tag) as tag from datamodel=Authentication where nodename=Authentication.Failed_Authentication by Authentication.app Authentication.src 

PickleRick
SplunkTrust
SplunkTrust

Naaah. That was my mistake in copy-pasting (didn't want to paste the whole search since it had more fields which were not important at the time). My original SPL did include the "from datamodel=" clause.

But thanks for the heads-up.

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...