4
responses

Hi,

I want to log from my nxlog.conf to my LogFile.

Example: nxlog.conf:

include additonal/*.conf

additonal/module.conf

Log DEBUG "module.conf included"

How can i do this?

AskedJuly 21, 2020 - 3:36pm

Answer (1)

Hello,

I'm not sure what you'd like to achieve. `nxlog.conf` is the main config file, where you define sources of your logs, the way of handling them, and targets where logs should be forwarded.

I recommend spending a while on analyzing the documentation (I assume you're interested in the community edition): https://nxlog.co/docs/nxlog-ce/nxlog-reference-manual.html. You can find many examples of configs there - I believe that's the best starting point.

Once you find what's interesting for you - solving any issues would much more feasible.

Best of luck!
Rafal

Comments (3)

  • framold's picture

    I want nxlog to log, when it parses the config file. I want it to log, that it found the correct include file. This is helpful when you include with wildcards.

  • raf's picture
    (NXLog)

    Sure, nxlog is a perfect solution when it comes to logging!

    However, we'd need to know what kind of logs and from which sources you want to collect, as well as what would be the expected destination.

    Especially in terms of wildcards, it would be good to know which operating system do you use?

    Could you share your conf files and tell more about the context of your log collection?

    Regards,

    Rafal

  • framold's picture

    nxlog.conf:

    include <abs_path_to_additional>/*.conf
    

    path/additional/route1.conf:

    <Input tcp>
        Module  im_tcp
        Port    1514
        Host    0.0.0.0
        Exec    parse_syslog_bsd();
    </Input>
    
    <Output file>
        Module  om_file
        File    "tmp/output_" + $Hostname + "_" + month(now())
        <Exec>
            if file->file_size() > 15M
            {
                $newfile = "tmp/output_" + $Hostname + "_" +
                            strftime(now(), "%Y%m%d%H%M%S");
                file->rotate_to($newfile);
                exec_async("/bin/bzip2", $newfile);
            }
        </Exec>
    </Output>
    
    <Route route1>
        Path    tcp => file
    </Route>
    

    I have no way of knowing if route1is loaded if nothing is logged per tcp. I want nxlog to print into its internal log (not the om_file), that it successfully included route1.conf.