Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document purpose of "hostname" field #147

Open
candlerb opened this issue Oct 29, 2019 · 1 comment
Open

Document purpose of "hostname" field #147

candlerb opened this issue Oct 29, 2019 · 1 comment

Comments

@candlerb
Copy link
Contributor

Is your feature request related to a problem? Please describe.
JSON mapping includes a "hostname" field, but I am unclear as to what this is used for.

I could map the syslog hostname to this field:

{"software":"rsyslog",...,"hostname":"hostname"}

This would be a useful thing to record somewhere, since if a syslog message is relayed through intermediate servers, the host where the message originated does not necessarily match the syslog-source-ip (which is the last relay)

However, in src/processors/engine.c I see the hostname used to construct a URL, whose purpose I don't know:

            if ( SaganProcSyslog_LOCAL->hostname[0] != '\0' )
                {
                    char tmp_normalize_http_uri[MAX_HOSTNAME_SIZE + MAX_URL_SIZE] = { 0 };
                    snprintf(tmp_normalize_http_uri, sizeof(tmp_normalize_http_uri), "%s%s", SaganProcSyslog_LOCAL->hostname, SaganProcSyslog_LOCAL->url);
                    normalize_http_uri = tmp_normalize_http_uri;
                }

So maybe "hostname" is intended for something else (e.g. hostname of the sagan server? hostname of some third-party checking service?)

I also observe that the pipe input format does not define a hostname field. The first field is enforced to be an IP address in src/input-pipe.c so you can't put the hostname from the syslog message here.

Describe the solution you'd like
Document purpose of "hostname". If it's meant to be used for the syslog hostname then also add it to the "syslog-ng" entry in json-input.map

Describe alternatives you've considered
N/A

Additional context
N/A

@beave
Copy link
Owner

beave commented Oct 30, 2019

This does need to be documented. This is pretty new. I'm going to try and work on documentation on the flight home. Leaving this open to remind me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants