Hi,

$EventTime is UTC.
It is not possible to convert it to a string representation with the UTC
timezone using strftime() because the underlying API does not support
this.
What you can do is:
* Use the Binary mode to transfer data. It serializes the datetime type
  correctly. 
* Convert the datetime to a string expressed as an integer timestamp and
  parse it back at the other end.
  POC:
   #sender
   $EventTime = 2014-05-12 12:05:39;
   log_info($EventTime);
   $EventTime = string(integer($EventTime));
   log_info($EventTime);
   #receiver
   $EventTime = datetime(integer($EventTime));
   log_info($EventTime);
  This gives:
   2014-05-12 12:05:39
   1399889139000000
   2014-05-12 12:05:39
* Use +Z in strftime to format it with a timezone. This won't be UTC
  unless the machine is configured that way but it is human readable and
  can be parsed back. Windows has issues with the Z.

Using JSON to serialize structured data has become quite popular recently.
Unfortunately there are two issues with this currently:
1. The JSON standard does not define a datetime type. Doing a to_json()
and then a parse_json() results in $EventTime converted to a string, so
you need to add an explicit $EventTime = parsedate($EventTime);
There are plans to make this automatic.
2. When the fields are serialized to JSON, the datetime type is converted
to a string expressed in local time without a timezone. Thus sending
data across timezones is problematic. This will be solved too.

Regards,
Botond


On Mon, 12 May 2014 14:18:10 -0700
Nate Fox <the...@gmail.com> wrote:

> I have the following on a windows machine:
> 
> <Input event_viewer>
>     Module      im_msvistalog
>     Exec        $EventTime = strftime($EventTime, "%Y-%m-%dT%H:%M:%S");
> </Input>
> 
> Is there any way to convert this to UTC regardless of what timezone I have
> configured for the machine?
> 
> I'd love something like strftime(to_utc($EventTime), "%Y-%m-%dT%H:%M:%S");

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
nxlog-ce-users mailing list
nxlog-ce-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users

Reply via email to