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

Add access to HOSTNAME enviroment variable #1396

Closed
wants to merge 1 commit into from

Conversation

coolacid
Copy link
Contributor

$HOSTNAME is a bash specific variable, and not exported by default.

This PR will check to see if the BASH $HOSTNAME is available, otherwise set it using the hostname command.

Then, EXPORT this variable for access using the ENV filter.

@jordansissel
Copy link
Contributor

Curious, what does this fix? I don't think we use $HOSTNAME anywhere, do we? Plugins should be using Socket#gethostname if they want to know the name of the machine.

@coolacid
Copy link
Contributor Author

It allows users to reference the logstash host name in the ENV filter. This can be set to say a field. This then can be referenced in future filters or outputs. For example, I'd like to reference the logstash indexer host name when defining outputs to graphite, or statsd.

It's also useful should you want to log/trace the path of an event by setting fields at each processing point.

I'm sure there are other uses, just can't think of them off the top of my head.

@coolacid
Copy link
Contributor Author

@jameshueston We talked about this on IRC - if it works can you give a 👍

@elasticsearch-release
Copy link

Can one of the admins verify this patch?

@elasticsearch-release
Copy link

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'.

1 similar comment
@elasticsearch-release
Copy link

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'.

@suyograo suyograo closed this May 13, 2017
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

Successfully merging this pull request may close these issues.

4 participants