I am stuck. Have tried all of the options I have found. Most come close, but cannot make it work. I collect data from a CMDB that has field with a date I need to filter on, created_date. What I ...
See more...
I am stuck. Have tried all of the options I have found. Most come close, but cannot make it work. I collect data from a CMDB that has field with a date I need to filter on, created_date. What I am trying to accomplish: Generate a query for all events of the past 3 weeks where there are CMDB events that have a field "created_date" spanning multiple months, I only want those events that have a created_date that falls with the the 3 week period. If I use the following query, it returns as expected all events within the three week period. What I want are all events based on the created_date, not based on _time. BTW, created_date has a standard time output: "%Y-%m-%d %H:%M:%S" index=cmdb dv_number=* dv_assigned_to=* dv_state=* created_date earliest=3w@w latest=@w
| search [| inputlookup cmdb_users.csv| table dv_assigned_to ]
| timechart span1w count(dv_number) What I also tried, was converting the field created_date, to _time using the following, which turned created_date into epoch, but did produce the correct _time ouput, but cannot use earliest/latest since my understanding is earliest/latest only work on the initial search. index=cmdb dv_number=* dv_assigned_to=* dv_state=* created_date earliest=3w@w latest=@w
| search [| inputlookup cmdb_users.csv| table dv_assigned_to ]
| eval created_date=strptime(created_date,"%Y-%m-%d %H:%M:%S")
| eval _time=created_date
........
.....
.. I also tried using a where statement, which partially worked, but would only cover the outer boundary (3weeks), not the inner boundary of the end of the last week. | where created_date <= relative_time(now(), "-3w@w") AND created_date >= relative_time(now()), "@w")