Splunk Dev

Is it possible to provide event sampling in splunk SDK call?

ashiqm
Explorer

I tried to pass sampleRatio parameter in JobsArgs, but no luck. Is there any way to set sampling ratio in Splunk job?

1 Solution

damien_chillet
Builder

I managed to have it working with parameter "sample_ratio" and python SDK.

Code sample below for 1:10 ratio:

job = instance.jobs.create("search index=_internal component=* earliest=-1d@d", **{ "sample_ratio": 10})

View solution in original post

damien_chillet
Builder

I managed to have it working with parameter "sample_ratio" and python SDK.

Code sample below for 1:10 ratio:

job = instance.jobs.create("search index=_internal component=* earliest=-1d@d", **{ "sample_ratio": 10})

ashiqm
Explorer

Hi Damien,

Thanks for your reply...

In this case, I can't supply the arguments, right?

my current code is something like this job = splunk.getJobs().create(query, jobArgs);

I have some arguments like timeOut. Any idea?

0 Karma

damien_chillet
Builder

Hi ashiqm,

Unfortunately I don't work with the Java SDK.
Apparently there is no existing setter method for sample_ratio, so you would have to write your own.

May be worth it to re-ask your question specifying you are using Java SDK so Java SDK users get visibility on your question.

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...