Mapping hardware hostnames from syslogs to Datadog "hostname" attribute #9905
-
I am looking to send syslogs from hardware to Vector, and transform this to JSON and remap the hostname attribute from the syslogs to "hostname" so logs in Datadog say they are from that host, not the system doing the relay like syslog-ng does. Is this possible? |
Beta Was this translation helpful? Give feedback.
Answered by
spencergilbert
Nov 4, 2021
Replies: 1 comment 2 replies
-
Yes! The {
"appname": "non",
"[email protected]": "1011",
"[email protected]": "Application",
"[email protected]": "3",
"facility": "user",
"hostname": "dynamicwireless.name",
"message": "Try to override the THX port, maybe it will reboot the neural interface!",
"msgid": "ID931",
"procid": 2426,
"severity": "notice",
"timestamp": "2020-03-13T20:45:38.119Z",
"version": 1
} So for example your script could look something like this . = parse_syslog!(.message) # replaces the original event with the parsed message field
.host = del(.hostname) # I think DD will use either host or hostname but you can specify as you need |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
lognarly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes! The
parse_syslog
function will return an object like this:So for example your script could look something like this