Splunk Dev

Can i only change the xyz.py file but not xyz.pyo to extend the module functionality?

William
Path Finder

There are many modules under '$Splunk\share\splunk\search_mrsparkle\modules'. And the module consists of .js, .html, .css, .conf, .py, and .pyo files.

So, for the module which has .py and .pyo files, such as 'EventsViewer', can I just modify the EventsViewer.py but not the EventsViewer.pyo to extend the functionality to some extent? Because it is not that easy to compile python files under splunk framework?

Tags (3)
0 Karma
2 Solutions

gkanapathy
Splunk Employee
Splunk Employee

First of all, it's not supported to modify it. Upgrades will overwrite it, documentation is not provided, and you will not get help from Splunk Support with it. If you want, perhaps you can copy and create a new version to use. Second, yes, you only need to modify the .py files. .pyo files are generated when they are out of date with respect to .py files. Also, there is no point in compiling Python for the Splunk UI, other than the possibly some marginal improvement improvement in time to start the server or load a page for the first time.

View solution in original post

0 Karma

Johnvey
Contributor

You don't have to worry about PYC or PYO files -- those are automatically generated by the Python interpreter upon startup. If you delete all the PYC or PYO files, they will simply be regenerated as needed. The difference between the 2 is only how fast they load, not how fast they execute.

For more information on compiled Python, read this explanation by Guido.

View solution in original post

Johnvey
Contributor

You don't have to worry about PYC or PYO files -- those are automatically generated by the Python interpreter upon startup. If you delete all the PYC or PYO files, they will simply be regenerated as needed. The difference between the 2 is only how fast they load, not how fast they execute.

For more information on compiled Python, read this explanation by Guido.

gkanapathy
Splunk Employee
Splunk Employee

First of all, it's not supported to modify it. Upgrades will overwrite it, documentation is not provided, and you will not get help from Splunk Support with it. If you want, perhaps you can copy and create a new version to use. Second, yes, you only need to modify the .py files. .pyo files are generated when they are out of date with respect to .py files. Also, there is no point in compiling Python for the Splunk UI, other than the possibly some marginal improvement improvement in time to start the server or load a page for the first time.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...