I am starting to work with chefserver. I want to get some calculation from the logs of chefserver. However, the time stamp is displayed without milliseconds. In order to get more precise calculation I want the logs of the recipes to have milliseconds.
The logs are in the following format:
[2017-08-29T18:44:22+00:00] INFO: bash[dummyResource] ran successfully
Thanks in advance
You can change the formatter in your client.rb (or in cookbook library code but then it would only affect things after that code runs):
Chef::Log.logger.formatter = whatever
https://github.com/chef/mixlib-log/blob/master/lib/mixlib/log/formatter.rb shows the default formatter, you can subclass and tweak as you desire.
Related
I want to test a simple strategy based on time: every day at fixed time check some conditions and go long. every day at fixed time exit.
Whatever I try to get timeOpenCondition I get syntax error.
Tried things similar to:
EntryTime = if hour=0800 and minute=0
ExitTime = if hour=1400 and minute=0
It feels like I don't get the concept of how this works. Appreciate any help!
I am wondering about power automate flow and I issues I had.
I am trying to set up initialize variables for checking time (european standard time) in my rules.
Expression looks like this -
startOfHour(convertFromUtc(triggerOutputs()?['body/receivedDateTime'],'Central European Standard Time','t'), 't')
Under variables I have condition which (True/Not) like this -
YES - time is greater than 22:30 PM
NO - time is less than 8:00 AM
If condition is true, my e-mail is forwarded to another outlook mailbox.
If not, nothing happened.
But this flow doesn't work :D
Can you help me resolve it ?
Thanks a lot !
First part prtscrn
Second part prtscrn
Given the information provided, I suggest the following:
Get the current time.
Convert it to the desired time zone. You can use the built in function to avoid calculation errors.
Convert only hour and minute to Integer. For example, 14:33 would be 1433.
Compare integers. This is: if time is greater than 2230 and less than 830, then forward email.
The flow might look like this:
I used daily this request to googleapi in my application:
GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={CHANNEL_ID}&maxResults=25&order=date&publishedAfter=2019-03-15T18%3A01%3A02.000Z&publishedBefore=2019-03-17T09%3A58%3A15.000Z&type=video&key={API_KEY}
Timestamps were of course changed each time. This worked fine till yesterday. Today this command did not work properly and returns results from different (much larger) time period.
Their timestamps are 25 and appear random:
"2018-10-04T10:06:56.000Z"
"2015-03-05T16:55:26.000Z"
"2018-09-24T08:05:59.000Z"
"2019-03-10T14:22:14.000Z"
"2018-07-24T19:08:39.000Z"
"2018-10-08T22:34:22.000Z"
"2018-09-10T11:38:37.000Z"
"2019-01-05T18:45:24.000Z"
"2019-02-12T07:00:07.000Z"
"2016-08-20T09:53:44.000Z"
"2018-10-20T21:31:43.000Z"
"2014-04-18T13:05:31.000Z"
"2019-01-24T14:00:30.000Z"
"2018-12-05T11:34:23.000Z"
"2019-03-04T13:59:05.000Z"
"2019-02-18T19:08:52.000Z"
"2018-12-24T11:33:56.000Z"
"2019-02-25T16:30:57.000Z"
"2017-07-07T16:44:59.000Z"
"2019-03-08T17:01:07.000Z"
"2019-02-04T12:49:42.000Z"
"2018-10-01T09:38:39.000Z"
"2015-09-18T22:52:30.000Z"
"2017-05-23T17:43:09.000Z"
"2019-03-13T17:59:24.000Z"
Is something broken?
Seems like it is a global problem.
https://support.google.com/youtube/thread/2494861?hl=en
I want to fetch record from the sys_user table which is updated at or after certain time stamp.
for that I have created rest request as
https:/service-now.com/api/now/v1//table/sys_user?sysparm_query=sys_updated_on>=javascript:gs.dateGenerate('2017-10-30','01:25:00')
I had converted current time which is in IST format into GMT and pass it to dateGenerate() function.
Problem statement -
I don't want to convert the IST to GMT, is there any way by which i can identify ServiceNow instance time zone at runtime and convert given time into that time stamp and get the users.
If i can pass this date and time in UTC format.
Ahoy!
This is a great question, and something that's quite difficult in ServiceNow (dealing with time-zones).
As such, I've written a tool to manage this for you. It's totally free!
The tool is called TimeZoneUtil, and can be found here:
https://snprotips.com/blog/2017/9/12/handling-timezones-in-servicenow-timezoneutil
You simply need to initialize a GlideDateTime object, set its' time-zone to IST, use setDisplayValue() to set its' time based on IST current time, then use .getValue() to get that same time in system time.
This is because getDisplayValue()/setDisplayValue() work based on time-zone, whereas setValue()/getValue() always return the corresponding system time.
EDIT: In order to make this a little more clear, I'll provide some example usage below.
var tz = new TimeZoneUtils(); //initialize with current time
gs.print(tz.getOffsetHours()); //prints out "-7" in my instance, as the system time is in Pacific.
tz.setTimeZone('Asia/Kolkata'); //sets the time-zone to IST/UTC+5.5
gs.print(tz.getOffsetHours()); //prints "5.5".
gs.print(tz.getGDT().getDisplayValue()); //Prints the current time in IST (2017-11-01 20:52:31 at the moment).
gs.print(tz.getGDT().getValue()); //Prints the current time in system time (2017-11-01 15:23:12 at present).
gs.print(new TimeZoneUtils().setTimeZone('Asia/Kolkata').getDisplayValue()); //Single line, also prints current time in IST: 2017-11-01 20:52:31
The first 6 lines there, demonstrate basic usage and explain how it works.
The eighth line however, demonstrates usage on a single line, which you can use inside a query string. For example:
sysparm_query=sys_updated_on>=javascript:new TimeZoneUtils().setTimeZone('Asia/Kolkata').getDisplayValue()
Hope this helps!
Tim Woodruff
Author, Learning ServiceNow & Building Powerful Workflows
Owner/Founder, SN Pro Tips
How can I get current time in 24 hours format in JMeter.
I tried ${__time(hh:mm a,)} but it results in AM/PM format.
As per How to Use JMeter Functions guide JMeter's __time() function output can be controlled via SimpleDateFormat class patterns.
Looking into JavaDoc:
you don't need a letter
you need to use capital H for 0-24 hours or lowercase k for 1-23 hours
So change function to ${__time(HH:mm,)} and that should be it
In Apache JMeter 5.2, current time can be captured in User defined variable and then used in Rest payloads as following screenshot:
expression - ${__timeShift(yyyy-MM-dd'T'HH:mm:ss'.000+05:30',,PT0S,,)}
output - "2020-06-06T18:10:59.000+05:30"
Here, date and time format can be changed as per the need.
Once current date and time is captured in user defined variable then it can be used as "${now-date-time}" in REST requests.
It could also be possible that we face a scenario where there should be gap of, let's say, 1second between start time and end time while constructing request. In such case, following expressions can help:
now-date-time : ${__timeShift(yyyy-MM-dd'T'HH:mm:ss'.000+05:30',,PT0S,,)}
now-date-time-plus-one-second : ${__timeShift(yyyy-MM-dd'T'HH:mm:ss'.000+05:30',,PT1S,,)}
Following example better explains it: