Using syslog-ng with OpenSearch 3.9

You are currently viewing Using syslog-ng with OpenSearch 3.9

Does syslog-ng support the latest OpenSearch version? I suspected that the answer was yes, but I gave it a try anyway. And as expected, starting to use OpenSearch 3.9 with syslog-ng is a smooth experience.

My only problem? Finding a password complex enough for OpenSearch. I added the OpenSearch and OpenSearch Dashboard repositories on my RockyLinux 10 machine and tried installing OpenSearch. But my first attempt ended up downloading over a gigabyte of data and then failing due to password complexity problems. However, on my second try, with a complex enough password, it installed smoothly. For OpenSearch Dashboard, I made a single configuration change to make sure that I can access it remotely, not just from localhost:

[root@localhost ~]# diff /etc/opensearch-dashboards/opensearch_dashboards.yml~ /etc/opensearch-dashboards/opensearch_dashboards.yml
14c14
< # server.host: "localhost"
---
> server.host: "0.0.0.0"

Configuring syslog-ng was easy. I installed the latest syslog-ng version and used a configuration snippet that I prepared for Elasticsearch a few weeks ago. I only replaced the user and password:

destination d_elasticsearch_https {
    elasticsearch-http(
        url("https://localhost:9200/_bulk")
        index("syslog-ng")
        user("admin")
        password("XXX")
        template("$(format-json --scope rfc5424 --scope dot-nv-pairs
        --rekey .* --shift 1 --scope nv-pairs
        --exclude DATE @timestamp=${ISODATE})")
        tls(
            peer-verify(no)
        )
    );
};

log {
  source(s_sys);
  destination(d_elasticsearch_https);
};

Once I reloaded the syslog-ng configuration, the logs started appearing on the OpenSearch Dashboard.

Note that starting from syslog-ng 4.4, there is a dedicated opensearch() destination too, but the above test demonstrated that both are fully compatible. I recalled that there was a new driver only when reviewing my blog…

You can find the explanation of the above configuration snippet and other related syslog-ng options at https://syslog-ng.github.io/admin-guide/070_Destinations/155_opensearch/README

–

If you have questions or comments related to syslog-ng, do not hesitate to contact us. You can reach us by email or even chat with us. For a list of possibilities, check our GitHub page under the “Community” section at https://github.com/syslog-ng/syslog-ng. On Twitter, I am available as @PCzanik, on Mastodon as @Pczanik@fosstodon.org.