file_name does't work. nxlog-ce-3.1.2319.msi


#1 ARTEM A

Hi,

I have installed nxlog service (nxlog-ce-3.1.2319.msi) on windows core 2019 machine. I have a config:

define EVENT_REGEX /^.*(<EventData>.+<\/EventData>)$/

<Extension xml> Module xm_xml </Extension>

<Extension json> Module xm_json </Extension>

<Input k8s_containers> Module im_file File "c:\var\log\containers*.log" <Exec> if $raw_event =~ %EVENT_REGEX% { parse_xml($1); } else { drop(); }

    $log_type = "k8s_container";
    $hostname = hostname();
    $host_ip  = host_ip();
    $log_file = file_name();

    if $log_file =~ /(.+)_(.+)_(.+)-(.+).log$/
    {
        $k8s_pod = $1;
        $k8s_namespace = $2;
        $k8s_container = $3;
        $k8s_container_id = $4;
    }

    to_json();

&lt;/Exec&gt;

</Input>

<Output file> Module om_file File "c:\k\nxlog.log" </Output>

<Route containerlog> Path k8s_containers => file </Route>

Everythings work fine, but log line has “log_file”: “unknown”. And because of that I didn't get $k8s_* fields.

How should I debug/resolv this issue?

#2 laszlofoldesiDeactivated Nxlog ✓ (Last updated )

Hello Artem!

Issue has been reported for the development teams, please follow the issue in gitlab.

Our plans is to deliver the fix in the next release.

Thanks your patient, and have a nice weekend.

Br

Laszlo