Getting Data In

Filtering logs not working as expected

vimselva
Explorer

I have tried to solve this problem with all the combinations, but missing some key thing on how to resolve.

I have various logs coming with source pattern as /var/log/containers/*. I would like to drop the DEBUG logs and hence have the following in props.conf:

[source://var/log/containers/*]
TRANSFORMS-null = debug_to_null
and in transforms.conf:
 
[debug_to_null]
REGEX = DEBUG
DEST_KEY = queue
FORMAT = nullQueue
After making the above change, as expected the logs with DEBUG keyword is getting dropped.
 
Now, I would also like to drop logs with another pattern for a particular source pattern under /var/log/containers, so I've updated my props.conf like this:
 
[source::/var/log/containers/*_integration-business*.log]
TRANSFORMS-null = setnull

[source://var/log/containers/*]
TRANSFORMS-null = debug_to_null

 

and updated transforms.conf like this:

[debug_to_null]
REGEX = DEBUG
DEST_KEY = queue
FORMAT = nullQueue


[setnull]
REGEX = NormalizedApiId failed to resolve
DEST_KEY = queue
FORMAT = nullQueue

 

After making this change, I can see only logs with DEBUG keyword is getting dropped, however the logs with NormalizedApiId failed to resolve are still being ingested.

I was hoping that logs with DEBUG keyword from all source paths with /var/log/containers/* pattern will be dropped and NormalizedApiId failed to resolve keyword from a particular source path with /var/log/containers/*_integration-business*.log pattern will be dropped. But seems not working that way.

Please guide me on this.

Labels (3)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust

Hi

try to change another TRANSFORMS definition to something else like TRANSFORMS-null-ib-log instead of use just TRANSFORS-null twice.

https://docs.splunk.com/Documentation/Splunk/latest/Admin/Attributeprecedencewithinafile

r. Ismo

View solution in original post

isoutamo
SplunkTrust
SplunkTrust

Hi

try to change another TRANSFORMS definition to something else like TRANSFORMS-null-ib-log instead of use just TRANSFORS-null twice.

https://docs.splunk.com/Documentation/Splunk/latest/Admin/Attributeprecedencewithinafile

r. Ismo

vimselva
Explorer

Thank you @isoutamo , that worked after updating the key.

However, still puzzled on after adding another stanza. My current props.conf:

[source::/var/log/containers/*_integration-business*.log]
TRANSFORMS-int-null = setnull

[source::/var/log/containers/*_0091*.log]
TRANSFORMS-set = allow_all

[source::/var/log/containers/*]
TRANSFORMS-null = debug_to_null

and transforms.conf:

[allow_all]
REGEX = .
DEST_KEY = QUEUE
FORMAT = indexQueue

[setnull]
REGEX = NormalizedApiId failed to resolve
DEST_KEY = queue
FORMAT = nullQueue

[debug_to_null]
REGEX = DEBUG|Debug|debug
DEST_KEY = queue
FORMAT = nullQueue

So I would like to allow any logs including DEBUG keyword from the source pattern /var/log/containers/*_0091*.log, however I see the logs with DEBUG keyword from that particular source pattern is being dropped. Is this even possible to do?

0 Karma

isoutamo
SplunkTrust
SplunkTrust
Maybe you could utilize that priority attribute with those two sources and use same TRANSFORMS-null attribute with both of those sources? See details from previous doc link.

vimselva
Explorer

You are great, that worked! Thank you for sharing knowledge.

gcusello
SplunkTrust
SplunkTrust

Hi @vimselva ,

check in search dashboard if the regex is correct using the regex command:

<your_search>
| regex "NormalizedApiId failed to resolve"

Ciao.

Giuseppe

0 Karma

vimselva
Explorer

Yes the regex is correct and validated.

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 ...