Bug 1600171 - Rsyslog omelasticsearch does not work with ES 6.x strict headers
Summary: Rsyslog omelasticsearch does not work with ES 6.x strict headers
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rsyslog
Version: 7.5
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Jiří Vymazal
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Keywords: Patch, Triaged
Depends On:
Blocks: 1649308
TreeView+ depends on / blocked
 
Reported: 2018-07-11 15:06 UTC by Lukas Zapletal
Modified: 2019-03-26 09:26 UTC (History)
6 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2019-03-26 09:23:27 UTC


Attachments (Terms of Use)
set content-type: application/json; charset=utf-8 (1.38 KB, patch)
2018-07-16 21:58 UTC, Rich Megginson
no flags Details | Diff

Description Lukas Zapletal 2018-07-11 15:06:38 UTC
Hey,

# rpm -q rsyslog rsyslog-elasticsearch
rsyslog-8.24.0-16.el7_5.4.x86_64
rsyslog-elasticsearch-8.24.0-16.el7_5.4.x86_64

Rsyslog in RHEL 7.5 is not able to push data into Elastic 6.x due to breaking API change - https://www.elastic.co/blog/strict-content-type-checking-for-elasticsearch-rest-requests

It used to be opt-out, now in 6.x series this can't be configured anymore:

# curl -i -H "Content-Type: xxx" -XGET 'http://localhost:9200/' -d '{}\n'
HTTP/1.1 200 OK
Warning: 299 Elasticsearch-5.4.3-eed30a8 "Content type detection for rest requests is deprecated. Specify the content type using the [Content-Type] header." "Wed, 26 Jul 2017 14:33:28 GMT"

Now in 6.x:

# curl -i -H "Content-Type: xxx" -XGET 'http://localhost:9200/' -d '{}\n'
HTTP/1.1 406 Not Acceptable
content-type: application/json; charset=UTF-8
content-length: 74

{"error":"Content-Type header [xxx] is not supported","status":406}

Upstream does seem to send the header correctly, I request backport of this into RHEL7 please.

https://github.com/rsyslog/rsyslog/commit/462be8b2ee4747a5317930d11018ce5ccb3726e0
https://github.com/rsyslog/rsyslog/commit/50d8e5cb391d8e0b984c725066a688da8b723b61

Thanks!

Comment 2 Lukas Zapletal 2018-07-11 15:09:53 UTC
REPRODUCER:

Install RHEL 7.5 and:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-6.3.1.rpm
rpm -i elasticsearch-oss-6.3.1.rpm
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl start elasticsearch.service

Create config:
module(load="omelasticsearch")
template(name="viaq_template" type="list") {
    property(name="$!all-json-plain")
}
action(
    type="omelasticsearch"
    server="localhost"
    serverport="9200"
    template="viaq_template"
    searchIndex="template1"
    errorfile="/var/lib/rsyslog/es-errors.log"
)

And see es-errors.log:

        "request":      {
                "url":  "http://localhost:9200/project.foreman-2018-11-07/events",
                "postdata":     "{\"message\":\"Completed 200 OK in 20ms (Views: 1.3ms | ActiveRecord: 8.4ms)\\n\",\"level\":\"info\",\"hostname\":\"next\",\"@timestamp\":\"2018-07-11T16:08:47.980943+01:00\",\"systemd\":{\"t\":{\"MACHINE_ID\":\"ce37bff78932646b63dbb85e691a3808\",\"BOOT_ID\":\"0b261792c25849a4b028268ada1ae861\",\"CAP_EFFECTIVE\":\"0\",\"CMDLINE\":\"Passenger RackApp: \\/usr\\/share\\/foreman                                      \",\"COMM\":\"ruby\",\"EXE\":\"\\/opt\\/rh\\/rh-ruby24\\/root\\/usr\\/bin\\/ruby\",\"GID\":\"991\",\"HOSTNAME\":\"next.nat.lan\",\"PID\":\"2630\",\"SELINUX_CONTEXT\":\"system_u:system_r:passenger_t:s0\",\"SOURCE_REALTIME_TIMESTAMP\":\"1531321727980804\",\"SYSTEMD_CGROUP\":\"\\/system.slice\\/httpd.service\",\"SYSTEMD_SLICE\":\"system.slice\",\"SYSTEMD_UNIT\":\"httpd.service\",\"TRANSPORT\":\"journal\",\"UID\":\"993\"},\"u\":{\"SYSLOG_FACILITY\":\"176\",\"SYSLOG_IDENTIFIER\":\"foreman\"}},\"MESSAGE\":\"Completed 200 OK in 20ms (Views: 1.3ms | ActiveRecord: 8.4ms)\\n\",\"msg\":\"Completed 200 OK in 20ms (Views: 1.3ms | ActiveRecord: 8.4ms)\",\"foreman\":{\"logger\":\"app\",\"user_login\":\"admin\",\"remote_ip\":\"192.168.199.1\",\"request\":\"6c3cbb4b-e731-4481-9060-63d57d719dbb\",\"session\":\"61feb0a7-479a-40cd-a4f2-50a365258734\"}}"
        },
        "reply":        {
                "error":        "Content-Type header [text/json; charset=utf-8] is not supported",
                "status":       406
        }

Comment 3 Lukas Vlcek 2018-07-11 15:15:23 UTC
I think we already have ticket for it here: https://github.com/openshift/origin-aggregated-logging/issues/625

This will be implemented once we upgrade to ES 6.x I would not expect us to implement it before we finish upgrade to ES 5.x

Comment 4 Rich Megginson 2018-07-16 21:58 UTC
Created attachment 1459274 [details]
set content-type: application/json; charset=utf-8

Comment 7 Jonas Steinberg 2018-11-02 19:30:13 UTC
Is there any update on this?  It's effecting my ES 6 infrastructure.  I'd be happy to help in any way that I can.

Comment 8 Jiří Vymazal 2019-03-26 09:23:27 UTC
This issue was not selected to be included either in Red Hat Enterprise Linux 7.7 because it is seen either as low or moderate impact to a small amount of use-cases. The next release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available. We will now close this issue, but if you believe that it qualifies for the Maintenance Support 1 Phase, please re-open; otherwise we recommend moving the request to Red Hat Enterprise Linux 8 if applicable.


Note You need to log in before you can comment on or make changes to this bug.