Knowledge Management

How to tag as datamodel attribute?

PickleRick
Ultra Champion

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
Legend

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
Ultra Champion

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
Legend

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
Path Finder

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
Ultra Champion

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
Ultra Champion

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
Path Finder

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
Ultra Champion

Nice find! Thanks. That might be it.

0 Karma

smurf
Path Finder

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
Ultra Champion

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!

Splunk Forwarders and Forced Time Based Load Balancing

Splunk customers use universal forwarders to collect and send data to Splunk. A universal forwarder can send ...

NEW! Log Views in Splunk Observability Dashboards Gives Context From a Single Page

Today, Splunk Observability releases log views, a new feature for users to add their logs data from Splunk Log ...

Last Chance to Submit Your Paper For BSides Splunk - Deadline is August 12th!

Hello everyone! Don't wait to submit - The deadline is August 12th! We have truly missed the community so ...