Problem to execute enhancement
Hello, I am trying to perform an enhancement to fix the timestamp, as suggested in issue #1047, but I am not able to run the enhancement.

Try touch modules/__init__.py
This file already exists, and I have reviewed the mach_enhancements parameter of the rules several times. Any suggestions to solve this problem?
Thanks.
I think syntax errors can cause this. Try running the file manually:
python modules/Time.py
I ran this command but didn't get any debugging. Do you have other suggestions to solve this problem?
Could it be anything related to the version?
I tested the same enhancement on a machine that had version 0.1.8 and worked.
You need to be in the directory where the modules folder is. It looks from your prompt like you are in the rules folder.
I am not able to perform any enhancements all are giving this problem of not finding the file.
Any suggestion?
Are you running elastalert from the same directory that modules folder is in?
You should be able to run python -c "from modules import Test"
There was no problem with the command.

Have you got modules.Time.TimeEnhancement or modules.time_real.TimeEnhancement ?
I'm not sure what issues would cause "No module named ..." error other than:
- Not in the current directory
- No
__init__.py - Wrong name of folder
- Wrong name of .py file
In case, I modified the enhancement name only Time.py -> time_real.py, but all its points about the possible problem is really strange what is happening.
It really is weird. I've been doing a few more tests and when I had a machine with version 0.1.8 it worked perfectly, when I upgraded to the latest one then it started this problem again.
Is there another way to call an enhancement?
Thanks for help!
There is actually. I had completely forgotten about this, but if you just put "TimeEnhancement" into elastalert's enhacnements.py, it should load. Then you set the match_enhancements: ["TimeEnhancement"]
You can find the location of that file with
python -c "from elastalert import enhancements; print enhancements.__file__"
You can also test this out manually using the simple code from https://github.com/Yelp/elastalert/blob/master/elastalert/config.py#L87
Maybe it will yield some clues as to what is happening
$ python
>>> module_name = "modules.time_real.TimeEnhancement"
>>> module_path, module_class = module_name.rsplit('.', 1)
>>> base_module = __import__(module_path, globals(), locals(), [module_class])
>>> module = getattr(base_module, module_class)
Very strange the result.

I edited the comment, sorry about that! module_name = "modules...." not name =
There was no mistake

What the heck... I'm out of ideas. Check for typos?
Try putting the code into elastalert's enhancements.py like I suggested. Hopefully that works!
Man, now it worked. I don't know what its happen, but I execute the rules and it's worked Thanks
😌
Hello I added the enhancement code to /usr/local/elastalert/lib/python2.7/site-packages/elastalert/enhancements.py
from elastalert.util import pretty_ts
from elastalert.enhancements import BaseEnhancement
class TimeEnhancement(BaseEnhancement):
def process(self, match):
match['@timestamp'] = pretty_ts(match['@timestamp'])
However my alert timestamps still come through as UTC, an hour behind local time.