The conventional method of setting the serverHost
attribute is to configure it via the server_attribute
:
<match scalyr.*>
@type scalyr
....
server_attributes {
"serverHost": "fluentd-host",
}
The hostname can also be populated from the log directly, as the DataSet Fluentd plugin supports an alternative solution that allows a parsed field to be applied as the value of serverHost
. All you need to do is to add __origServerHost ${record["host"]}
to the record_transformer config ( i.e replacing serverHost
with the value of the host
field) and set use_hostname_for_serverhost
to false. For example,
#scalyr specific options
api_write_token YOUR_SCALYR_WRITE_TOKEN
...
use_hostname_for_serverhost false
...
<filter **>
@type record_transformer
<record>
__origServerHost ${record["host"]}
</record>
</filter>
Here is an example of the sample message sent to Fluentd
{"msg": "hello world", "host": "hostnameEmbededdinMsg"}
The value of the host
parameter is now correctly applied as the serverHost
attribute
Comments
0 comments
Please sign in to leave a comment.