1
response

Hi
I need to replace any accented vowel (á,é,í,ó,ú) on raw event. I tried (for just 'a' vowel):

$raw_event = replace($raw_event, "á", 'a');

But it doesn't work

AskedMay 29, 2018 - 12:10am

Answer (1)

I am not seeing your full conf or results, but you look like you are on the right path. Please see below for a working example.
Note: The log_info() lines are just to see the output and are not needed, as I test with nxlog -f -c nxlog.conf and can watch it in real time.

nxlog.conf :

Panic Soft
define LOGFILE nxlog.log
LogFile %LOGFILE%

<Input in>
    Module          im_file
    File            "input.log"
    SavePos         False
    ReadFromLast    False
    Exec            log_info("Source " + $raw_event);
    Exec            $raw_event = replace($raw_event, "á", "a");
    Exec            $raw_event = replace($raw_event, "é", "e");
    Exec            $raw_event = replace($raw_event, "í", "i");
    Exec            $raw_event = replace($raw_event, "ó", "o");
    Exec            $raw_event = replace($raw_event, "ú", "u");
</Input>
<Output file>
    Module          om_file
    File            "output.log"
    Exec            log_info("Destination " + $raw_event);
</Output>
<Route r1>
    Path in => file
</Route>

input.log :

á,é,í,ó,ú
ú,ó,í,é,á 
á,é,í,ó,ú
ú,ó,í,é,á