MessageLogging Policy - how to set value to host param value dynamically ?

Not applicable

Hi Team,

I am using Message logging policy. I would like to pass value to host parameter dynamically. Is ther any possible way to set value dynamically?

We have different environment under one organization, would like to dynamically set different host to message logging policy host based on environment.

Have read the documentation, it mentioned like below.

HostandPortelements cannot refer to variables. They must contain static values.

Please let me know if there is any possible best approach for my requirement.

Thanks,

Satheesh

Solved Solved
1 2 453
1 ACCEPTED SOLUTION

Hi Satheesh,

Right, you cannot use reference variables in Message Logging policy.

Usually, even if you have multiple environments, there is a centralized log aggregator which collects logs from all envs. This is usually accomplished by adding the env as a field in your Message Log.

If you have to send logs to different log servers, then I think you will have to use separate MessageLogging policy for each region and conditinally enforce them - something like this

<Step>

<Condition>system.region.name="test"</Condition>

<Name>WriteSyslogToTest</Name>
</Step>

<Step>

<Condition>system.region.name="test"</Condition>

<Name>WriteSyslogToProd</Name>
</Step>

Thanks,

View solution in original post

2 REPLIES 2

Hi Satheesh,

Right, you cannot use reference variables in Message Logging policy.

Usually, even if you have multiple environments, there is a centralized log aggregator which collects logs from all envs. This is usually accomplished by adding the env as a field in your Message Log.

If you have to send logs to different log servers, then I think you will have to use separate MessageLogging policy for each region and conditinally enforce them - something like this

<Step>

<Condition>system.region.name="test"</Condition>

<Name>WriteSyslogToTest</Name>
</Step>

<Step>

<Condition>system.region.name="test"</Condition>

<Name>WriteSyslogToProd</Name>
</Step>

Thanks,

Thanks for your suggestion, it works fine.