Skip to content

Add the client IP address to each message if requested in the configuration#3

Open
stanhu wants to merge 1 commit into
logstash-plugins:mainfrom
stanhu:add-client-address
Open

Add the client IP address to each message if requested in the configuration#3
stanhu wants to merge 1 commit into
logstash-plugins:mainfrom
stanhu:add-client-address

Conversation

@stanhu

@stanhu stanhu commented Jan 22, 2015

Copy link
Copy Markdown

Requires an update to the Lumberjack server (see https://github.com/stanhu/logstash-forwarder/tree/add-client-address) to pass along the address. I'm not quite sure how to tie the server version to the input filter version.

I considered putting this functionality in the Lumberjack server itself, but it seems like the input filter should decide this here, just as the TCP input filter does.

…ration

file. Requires an update to the Lumberjack server to pass along the address.
@jordansissel

Copy link
Copy Markdown
Contributor

Given this protocol uses TLS for authentication, it seems like it would provide more accuracy to use the client's SSL certificate subject instead of the client ip (because the real client address would be obscured by folks using proxies, etc). Thoughts?

@stanhu

stanhu commented Jan 22, 2015

Copy link
Copy Markdown
Author

I think there is still value in getting the IP address, even if proxies get in the way. Right now I have to workaround this by having each logstash-forwarder node perform an external IP lookup. Someone else also ran into this issue on Stack Overflow.

Are SSL client certificates being used here? If they are not, how would the server get the client's SSL certificate subject?

@jordansissel

Copy link
Copy Markdown
Contributor

@stanhu you can also set any arbitrary field you wish in the logstash-forwarder config. This would easily allow you to, on every node running lsf, set a special field that includes an IP, a name, or anything.

@stanhu

stanhu commented Jan 22, 2015

Copy link
Copy Markdown
Author

@jordansissel, thanks, I did see that. As far as I can tell, the key/values must be statically configured in the logstash-forwarder configuration. Since many of the machines I use have ephemeral IP addresses, having 100 different configuration files that need to kept up-to-date doesn't work so well.

@jordansissel

Copy link
Copy Markdown
Contributor

having 100 different configuration files

Apologies if this sounds like a rude question, but why not use configuration management to solve this for you? Generate your config files based on the system and everything will be groovy :)

@stanhu

stanhu commented Jan 23, 2015

Copy link
Copy Markdown
Author

We do use Ansible and it could populate the forwarder with the right info, but that's another moving piece that we have to get right. I'd rather have logstash just take care of it in one place.

@jordansissel

Copy link
Copy Markdown
Contributor

we have to get right

Well, someone has to get it right, somewhere. The purpose of the 'fields' setting in logstash-forwarder was for exactly these scenarios where you need to ship additional data along with events (perhaps cluster name, datacenter name, region name, application name, or other identification information).

@stanhu

stanhu commented Jan 23, 2015

Copy link
Copy Markdown
Author

Yes, it's useful for doing that, and we do use the extra fields for those kinds of things. The one challenge is that across machine reboots, ephemeral IP addresses may change, and so the configuration has to be be updated each time to reflect that and require a restart of the forwarder process.

In any case, an application may want to know that exactly which IP address from which the SSL server received the data. The data is readily available by the socket, and it should be made available. As you mentioned, there may be proxies that may be changing the actual IP address seen by the server. This may be another use case for this PR.

@jordansissel

Copy link
Copy Markdown
Contributor

It feels like we're both standing here saying "I don't want to do any work" to each other :\

@jordansissel

Copy link
Copy Markdown
Contributor

I'm open to adding IP source, but I'm not sure about the implementation here. I would prefer exposing everything we can know about the connection (certificate, etc) rather than focusing specifically on just one attribute like IP.

@stanhu

stanhu commented Jan 23, 2015

Copy link
Copy Markdown
Author

:) I like that idea. Another alternative I considered was to have the callback use the SSLSocket instance, but that potentially gives the input filter the ability to close/open a new connection.

We could whittle down the callback to a map of client data. Looking at the SSLSocket interface, I see a number of things that could be sent:

  1. Address family (e.g. INET/INET6/UNIX)
  2. Source IP
  3. Cipher
  4. List of client CAs
  5. Peer cert
  6. Peer certificate chain

Anything I missed?

jsvd pushed a commit to jsvd/logstash-input-lumberjack that referenced this pull request Aug 31, 2015
+::Dir.glob('vendor/*')

Remove erroneous files reference

Fixes logstash-plugins#3
@ghost

ghost commented Nov 2, 2015

Copy link
Copy Markdown

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run; then say 'jenkins, test it'.

@alvinlee001

Copy link
Copy Markdown

is this supported yet? Why is this not merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants