Getting Data In

Add-on-Builder: How to Input-Interval in cron-format?

LoMueller
Explorer

Hi all,
I'm trying to create a new input for our created RestAPI-Call.
As this call should only be executed once in a month (ticket-data) I struggle with the only available Interval-Option which is seconds and not crontab-format.
I further discovered that when setting interval in seconds having splunk restarted the counter of seconds starts from that point in time somehow that messes with a predicted input interval.
Question: Is it possible to use cron-entry in underlaying input.conf file in created AoB-App?

Thanks for any feedback

Lothar

Labels (1)
Tags (1)
0 Karma

Azeemering
Builder

You can always just modify the inputs.conf interval entry to a cron setting.

For example for At 00:00 on day-of-month 1.

interval=0 0 1 * *

 

 

LoMueller
Explorer

Thanks for your feedback.

Why does AoB then only provide seconds for the interval option and errors when trying to configure cron-formatted string?
Anybody able to put some light on this?

Lothar

0 Karma

diogofgm
SplunkTrust
SplunkTrust

You could use checkpoints in order to not mess to much with time intervals. I've implemented something before that calls a REST API and saves the last data point date as a checkpoint and the next time I call it I just use the checkpoint as a starting date. In the add-on python logic you can use anything, in your case that could ticket id, ticket last update time, etc. There are helper functions that already help you accomplish this. This method also allows you to have more recent data to work with.


Some links that might be helpful:
https://docs.splunk.com/Documentation/Splunk/8.2.6/AdvancedDev/ModInputsCheckpoint
https://docs.splunk.com/Documentation/AddonBuilder/4.1.0/UserGuide/PythonHelperFunctions

If you still want to go via the cron route there are some python libs (e.g. http://pypi.python.org/pypi/croniter/) that can convert cron into date time 

------------
Hope I was able to help you. If so, some karma would be appreciated.

LoMueller
Explorer

Thanks for your hints; actually we do not use python-scripts (only Rest-Call).
As the Rest-API itself provides ability to define timerange to report on we simple need a defined schedule to perform the call.
Interval in seconds is not that best vehicle as by restarting splunk count starts at timepoint of restart.

To undstand you correct, cron-timing is not available/possible with AoB?
Or can I simply edit inputs.conf?

Lothar

0 Karma

diogofgm
SplunkTrust
SplunkTrust

As far as I know its just seconds. Also, looking into the docs on configuring inputs it just states seconds. 

https://docs.splunk.com/Documentation/AddonBuilder/4.1.0/UserGuide/Usetheaddon

------------
Hope I was able to help you. If so, some karma would be appreciated.
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 ...