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!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...