is there a flow variable for hostname?

Not applicable

Looking for a simple way to get hostname in a variable in a flow. I want to use it for logging. Note: not the IP address- but the host name.

The documentation has this:

System variables

System variables contain system-related information. A system variable is prefixed with_system. wherever it is referenced. The part of the variable that appears after the prefix specifies the function in the system, such as host name, date, time, and interfaces. The supported system variables are listed below.

The problem is - host name is not mentioned in the list that follows.

I have tried system.host.name system.hostname - will keep trying unless someone can answer!

Solved Solved
0 21 2,918
1 ACCEPTED SOLUTION

Not applicable

The answer is NO

While there appear to by many options for working around this or using other data to achieve a similar result - access to a hostname variable is no longer supported, or even documented in edge (see the comments above - the documentation was apparently updated to correctly reflect this during the conversation)

View solution in original post

21 REPLIES 21

request.header.host ?

unfortunately that is the host name as it appears in the request header for the REQUESTING system. I want it for the system the message processor is running on.

So this answer doesnt actually answer my question. I translated the data there to this:

virtualHostName:{virtualhost.name}
host:{system.host.name}
host:{request.header.host}
RequestTimestamp:{system.time}
Host:{system.interface.eth0}
VirtualHost:{virtualhost.name}
ApigeeEnvironmentName:{apiproxy.name} - {proxy.name}
ApigeeApplication:{environment.name}
DeployedApplicationName:{ProxyAPIName}

in a message-logging policy. When i run it i get the output below - note that the host name is blank (which is why im asking this question....)

virtualHostName:default       
host:       
host:<calling-system-ip-address>        
RequestTimestamp:Thu, 13 Aug 2015 18:54:10 UTC
Host:<server-ip-address>
VirtualHost:my_vhost
ApigeeEnvironmentName:my_proxy - my_vhost
ApigeeApplication:development     
DeployedApplicationName:

where did you find system.host.name?

I see a variable 'system.interface.{interfacename}, that can get you the IP address of the MP - http://apigee.com/docs/api-services/reference/variables-reference

If you just want to uniquely identify a MP, you could also use system.uuid

So heres the thing - in my question i QUOTED the variable reference:

"

System variables contain system-related information. A system variable is prefixed with_system. wherever it is referenced. The part of the variable that appears after the prefix specifies the function in the system, such as **** host name **** , date, time, and interfaces. The supported system variables are listed below.

"

If this is wrong it should be corrected.

Personally I would rather that it be available and just not documented - because I NEED it.

One of the most powerful places to log is the "PostClientFlow" - in fact for our purposes - it is probably the only intelligent place to log much of what goes on in a transaction.

Unfortunately i cant use javascript in that flow to manipulate things - so i cant use derived values. It just isnt an option in that flow.

Message id: {messageid} will return a VERY LONG STRING that includes the host name. I would like to avoid having to use this with a truncate for my purposes if at all possible.

So nobody seems to have any information on this - or the general lack of ability to access a total request time in the post flow - so im going to have to wing it.

Hi @Benjamin Goldman - seems like this thread and question might be easier to resolve by working directly with one of our support engineers and looking at your specific case/environment. Or we should take a step back on this question and possibly reframe the problem in a new thread and continue to work together to solve it on the community while keeping collaborate spirit alive.

And thanks for the feedback about docs. @Floyd Jones will incorporate your feedback as appropriate.

I've removed the erroneous "host" reference from the descriptive paragraph for system variables. @Benjamin Goldman, big apologies for the confusion.

Not applicable

@apigeeks - note that the documentation mentions that there is a system "host name" variable in the paragraph describing what they are (as seen above) but that the grid of variables does not include it - and it seems to be empty!

Thanks.

Not applicable

Can you describe the use case where MP host name is needed for login. MP is a proxy should be ideally transparent to the backend system. Usually, with load balancing request originating MP will change. So understanding the usecase would help. Please let me know

Typo - fixed. LOGGING.

Not applicable

You should use system.uuid

Host name is not exposed on purpose. We do want any other side/security effects of exposing the host name to the user.

UUID is unqiue per host, so should work in your scenario.

Im going to move this to the private cloud forum.

The apigee UUID is pretty much useless to us in our environment. While i have other ways of getting the host -id into my log pipleine - the combination of the fact that it is actually mentioned in the documentation, and my need for it - makes me think it SHOULD be available.

Additionally - as someone pointed out - the messageid actually contains the host name (but in a form that is more than useless in the post processing flow - so it wont help me with my logging problem) - if this was actually a security problem - and on purpose - i would expect this to be changed immediately.

In any-case - i am not looking for a workaround. I need host name.

MessageId contains the router hostname not MPs. MessageId can be changed anytime to any other format - so i would not rely on that. I thought you wanted MP hostname.

We didnt know that - but it makes sense since the messageid is actually generated at the router. So using it to get at the host name is not a good solution. Im sStill looking for an answer though right? Straight quote from the variable documentation below - states it should be available.:

System variables

System variables contain system-related information. A system variable is prefixed with_system. wherever it is referenced. The part of the variable that appears after the prefix specifies the function in the system, such as host name, date, time, and interfaces. The supported system variables are listed below.

The latest documentation online does not contain host name in it. Anyway that does not help your case.

The solution I am trying to give you is to use UUID. My understanding is that you want to do logging of the hostname so that you can identity the MP from which the request was served. Since the host name is not available, UUID is you best bet. UUID is unique per MP (like the hostname). So it will help you identify the MP.

Now the next step is to map the UUID to hostname - since you need physical address. This is something you need to do externally - which finally will help your cause.

Is my understanding correct? Will this work for you?

Thanks for getting the documentation updated. You are correct - it is no longer mentioned.

Did you just update it?

I am going to have to enrich the logs out of edge outside of edge to get what I want now, or i will ask if we can get that system variable re-enabled for private cloud.

No i did not get it updated. I was trying to figure out where you saw the data mentioned. I realized its not there.

Not applicable

The answer is NO

While there appear to by many options for working around this or using other data to achieve a similar result - access to a hostname variable is no longer supported, or even documented in edge (see the comments above - the documentation was apparently updated to correctly reflect this during the conversation)