I am running a splunk query for a date range. It is working fine. I want to run the same query for different date ranges. Lets say 1day, 7days and a month. Example query which running for a day:
index="a" env="test" MachineIdentifier source="D:\\Inetpub\\Logs\\app*.log" earliest=-2d latest=-1d
| top limit=50 MachineIdentifier
| sort MachineIdentifier asc
Currently I am running this query for different date ranges by modifying "earliest" and "latest" values and exporting it for consolidation.
I want to prepare a single query which gives this data for 1day, 7day etc in a single report. Is it possible?
EDIT:
Figured out this query but I am not able to get percentage details like above query. How to show percentage details in the results.
index="a" env="test" MachineIdentifier source="D:\\Inetpub\\Logs\\app*.log" earliest=-2d@d latest=-1d@d
|fields MachineIdentifier | eval marker="1DayData"
| append
[search index="a" env="test" MachineIdentifier source="D:\\Inetpub\\Logs\\app*.log" earliest=-3d@d latest=-1d@d
|fields MachineIdentifier | eval marker="2DaysData"]
| stats count(eval(marker="1DayData")) AS 1DayCount, count(eval(marker="2DaysData")) AS 2DaysCount by MachineIdentifier