hi Joanna,
please check the following link for more information on Cygwin:
http://www.cygwin.com/
I would also recommend to have a look into SECwin package by Mina Gerges:
https://github.com/minagerges/SECwin
That package helps to automate installing SEC on windows and selecting
appropriate Perl package during installation. Moreover, SECwin runs SEC as
a Windows native service.
As for using the spawn or cspawn action for running an external converter,
here is a simple example that starts it at SEC (re)start with cspawn:
type=Single
ptype=RegExp
pattern=^(?:SEC_STARTUP|SEC_RESTART)$
context=[SEC_INTERNAL_EVENT]
desc=start an ucs-2 converter
action=cspawn MESSAGES (tail -F /var/log/ucs2log | /usr/local/bin/convert.pl
)
Each event that is read from /var/log/ucs2log is assigned an internal
context MESSAGES. If you don't care for an internal context (that helps to
distinguish events of /var/log/ucs2log from data from other input files),
you can use a simpler spawn action:
spawn (tail -F /var/log/ucs2log | /usr/local/bin/convert.pl)
As for convert.pl, here is a simplistic example written in Perl:
#!/usr/bin/perl -w
use Encode;
binmode(STDOUT, ":utf8");
$| = 1;
while (<STDIN>) {
$line = decode("ucs-2", $_);
print $line;
}
Of course, you can use any other converter in place of convert.pl, but if
you choose to harness a Perl-based script like the one above, I would also
recommend to have a look into perluniintro man page:
https://perldoc.perl.org/perluniintro.html
Hope this helps,
risto
2017-08-07 10:40 GMT+03:00 Joanna Christou <ioannachris...@hotmail.com>:
>
>
> Hi Mr Risto,
>
>
> Thank you for your reply,
>
>
> Please, can you give me more information on Cygwin Perl? And provide me
with an example of UCS-2 to UTF-8 converter via 'spawn' or 'cspawn' if it's
possible?
>
>
> Am beginner and I would appreciate your help! Thank you for your time.
>
>
> Thanks is advance,
>
> Joanna Christou
>
>
>
>
>
>
> ________________________________
> From: Risto Vaarandi <risto.vaara...@gmail.com>
> Sent: Thursday, August 3, 2017 12:24 PM
> To: Joanna Christou
> Cc: simple-evcorr-users@lists.sourceforge.net
> Subject: Re: [Simple-evcorr-users] Help
>
> hi Joanna,
> while SEC can be easily configured to run in UTF-8 mode by setting the
PERL_UNICODE environment variable, this approach apparently does not work
for UCS-2. One can of course manually add 'binmode' statements for UCS-2
files into SEC code, but doing it just for input files is not enough, since
one might want to use UCS-2 characters in rule files (e.g., regular
expressions with UCS-2 characters) and output files as well. Therefore,
changing the character set once via environment variable (or a global
statement in the header of SEC code) is the best approach, but currently
doesn't seem to be supported by Perl.
> I was also briefly thinking of running a UCS-2 to UTF-8 converter via
'spawn' or 'cspawn' action which would allow for SEC to see the file as a
stream of UTF-8 characters. While this approach would work on UNIX systems
and Windows with Cygwin Perl, Strawberry perl does not provide enough
emulation of UNIX system calls for 'spawn' and 'cspawn', and these actions
are enabled only with Cygwin Perl.
> kind regards,
> risto
>
> 2017-08-02 9:21 GMT+03:00 Joanna Christou <ioannachris...@hotmail.com>:
>>
>>
>> Hi,
>>
>> We are trying to use Simple Event Correlator via Perl on Windows
(Strawberry Perl) to do advanced processing of log file. The problem is the
log file is UCS-2 format and SEC only reads UTF-8 log files. Is there a way
to make SEC read a UCS-2 log file?
>>
>> Thanks in advance,
>> Joanna Christou
>>
>>
>>
>> Sent from my Samsung Galaxy smartphone.
>>
>>
------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Simple-evcorr-users mailing list
>> Simple-evcorr-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users
>>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users