We often do a search for device configuration changes on Cisco devices in a specific IP range in a certain time frame. From the web UI, the search would look something like this:
sng_host_ip=10.20.30.0/24 AND "%MGBL-CONFIG-6-DB_COMMIT"
We take the resulting table and export it to csv for analysis.
I want to find a way to do this same search from Python. I used the examples to get basic searches working, but I don't know how to get this same information. I need to specify the IP range, the log message I'm looking for and the time range. Here is an example where I tried to get all the log entries in that IP range starting from yesterday:
metadata type=hosts | regex host="10\.20\.30\.\d{1,3}" | gentimes start=7/7/2015
That resulted in this error:
Error in 'gentimes' command: This command must be the first command of a search.
I think I'm completely on the wrong track. Any thoughts?
Thanks!
... View more