Make apache.status.uptime.server_uptime human readable

How do I convert apache.status.uptime.server_uptime to human readable format and display it in a Visualization? I've tried multiple times in a scripted field but can't seem to get that to work either. Thanks.

Are you getting the value in seconds like from server-status?auto? If so, you should be able to divide by 86400 to get days, or 3600 to get hours.

Try with something like this in the scripted field

long days = ((doc['field'].value.getMillis()/1000)/86400);

No idea why but this is working now. This exact code wasn't working the other day haha.

Is there any way to make it say "6 days and 2 hours" instead of just "6 Days"? I get "6 days" when I switch "Output Format" to "Human Readable".

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.