All Apps and Add-ons

SA-cim_validator: How to write an eval expression to convert and validate field values like /pts/0, /pts/1...?

bagarwal
Path Finder

Hello,

I want to write an expression that converts values like /pts/0, /pts/1, /dev/pts/0 ... and so on to an expected value. Right now, CIM validator only considers expected values such as cron, ssh for the field app. Refer to the screenshot below. If anyone can help me, thanks in advance.

alt text

0 Karma
1 Solution

javiergn
Super Champion

What sort of conversion did you have in mind?

In any case you probably want something like:

eval app = case (
    match(app, "/pts/"), "ssh",
    match(app, "something else"), "cron",
    1 == 1, app
)

EDIT to include the final answer

I haven't used that CIM validator, I would normally use this other app: https://splunkbase.splunk.com/app/1621/

In any case, it seems the one you are using about has the following regex to identify what is a valid app and yours is not because it contains slashes:

^[\w:\-]+$

See this: https://github.com/hire-vladimir/SA-cim_validator/blob/master/lookups/cim_validator_field_regex.csv

Take a look at the CIM definition for the field app. There are no expected values I'm afraid.

http://docs.splunk.com/Documentation/CIM/latest/User/Authentication

In summary, if you want to be compliant with your app you could try removing those slashes or replacing them with something else:

| eval app = replace(app, "/", "")

View solution in original post

0 Karma

javiergn
Super Champion

What sort of conversion did you have in mind?

In any case you probably want something like:

eval app = case (
    match(app, "/pts/"), "ssh",
    match(app, "something else"), "cron",
    1 == 1, app
)

EDIT to include the final answer

I haven't used that CIM validator, I would normally use this other app: https://splunkbase.splunk.com/app/1621/

In any case, it seems the one you are using about has the following regex to identify what is a valid app and yours is not because it contains slashes:

^[\w:\-]+$

See this: https://github.com/hire-vladimir/SA-cim_validator/blob/master/lookups/cim_validator_field_regex.csv

Take a look at the CIM definition for the field app. There are no expected values I'm afraid.

http://docs.splunk.com/Documentation/CIM/latest/User/Authentication

In summary, if you want to be compliant with your app you could try removing those slashes or replacing them with something else:

| eval app = replace(app, "/", "")
0 Karma

bagarwal
Path Finder

Thank You so much for your response. I simply want that the value /pts/0, /pts/1, and so on should be considered as expected value as per CIM data model so can have 100 % CIM compliance for this field.

0 Karma

javiergn
Super Champion

I haven't used that CIM validator, I would normally used this other app: https://splunkbase.splunk.com/app/1621/

In any case, it seems the one you are using about has the following regex to identify what is a valid app and yours is not because it contains slashes:

^[\w:\-]+$

See this: https://github.com/hire-vladimir/SA-cim_validator/blob/master/lookups/cim_validator_field_regex.csv

Take a look at the CIM definition for the field app. There are no expected values I'm afraid.

http://docs.splunk.com/Documentation/CIM/latest/User/Authentication

In summary, if you want to be compliant with your app you could try removing those slashes or replacing them with something else:

| eval app = replace(app, "/", "")

bagarwal
Path Finder

@javiergn: Thanks a lot!! It works perfectly..

0 Karma

javiergn
Super Champion

No worries. If you are happy with the comment please mark it as answered so that others can benefit from it.

Thanks,
J

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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...