How to select the data for a fixed month

I am trying to print the data for June. How do I go by doing it?

I tried with this

SELECT average(diskUsedPercent) FROM StorageSample FACET apmApplicationNames, monthOf(timestamp) WHERE apmApplicationNames ='|Jira Prod|' and monthOf(timestamp) LIKE 'June'

That did not give me any output

Ah, this worked.

SELECT average(diskUsedPercent) FROM StorageSample FACET apmApplicationNames, monthOf(timestamp) WHERE apmApplicationNames =’|Jira Prod|’ and monthOf(timestamp) RLIKE r’June.*’

I wonder if there is a better way to achieve that, so I can control the month with a dropdown?

1 Like

You can facet on month. You can also set your Since and Until date range to something specific, but always use WITH Timezone.

I always have to know the last day of the month for UNTIL like '2021-06-30 23:59:59-0400' or '2021-07-31 23:59:59-0400'. I wish there is a way newrelic could fig out last day of a month.

Like I mentioned you can facet on the month.

1 Like

what is the syntax for that? I am already using FACET monthOf(timestamp). Also the requirement is to show only one month which would be current month.

“Since this Month” is probably what you want if you only ever want the current month.

1 Like

I did say current month, didn’t I? I apologize for the confusion. I actually meant individual month. So we need show report for each month only but have newrelic pick the boundary of the month correctly.

Yes, I was just following your explicit requirement.

So have you found that NR can do that kind of thing? Let you pick the month?

You can make a dashboard and the viewer can change the time range themselves. So you can create a dashboard and let someone configure their view for the month they want assuming the month is still retained.

You do not need to know the last day of the month (but how hard is that?) You can do since the 1st until the 1st using the dates like you have above.

SELECT count(*) from Transaction Since '2021-06-01 00:00:00' until '2021-07-01 00:00:00' WITH TIMEZONE 'America/New_York'

4 Likes

Excellent! Thank you so much for your help!