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

feat: Syslog input plugin logs remote IP to source tag #9440

Merged
merged 1 commit into from
Jul 20, 2022
Merged

feat: Syslog input plugin logs remote IP to source tag #9440

merged 1 commit into from
Jul 20, 2022

Conversation

thepacketgeek
Copy link
Contributor

@thepacketgeek thepacketgeek commented Jun 25, 2021

Required for all PRs:

  • Updated associated README.md.
  • Wrote appropriate unit tests.

resolves #4762

Add remote IP of syslog sender as source tag

This diff adds capturing of the remote IP Address (syslog sender) and adds it as a source tag for each Metric:

$ telegraf --test --config /etc/telegraf/telegraf.conf --input-filter syslog --test-wait 15
2021-06-25T17:55:06Z I! Starting Telegraf 
> syslog,appname=docker-compose,facility=daemon,host=bb8,hostname=droplet,location=home,severity=info,source=10.0.0.12 facility_code=3i,message="<redacted>",severity_code=6i,timestamp=1624643706396113000i,version=1i 1624643706400667198
> syslog,appname=tailscaled,facility=daemon,host=bb8,hostname=dev,location=home,severity=info,source=10.0.0.15 facility_code=3i,message="<redacted>",severity_code=6i,timestamp=1624643706403394000i,version=1i 1624643706407850408

@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Jun 25, 2021
@thepacketgeek
Copy link
Contributor Author

thepacketgeek commented Jun 25, 2021

Testing with provided artifacts: Gist of syslog messages with source tags

I'm planning on rebasing this PR after #8454 is merged

@thepacketgeek thepacketgeek marked this pull request as ready for review June 25, 2021 18:01
@thepacketgeek thepacketgeek changed the title Syslog input plugin logs remote IP to source tag feat: syslog input plugin logs remote IP to source tag Oct 2, 2021
@thepacketgeek thepacketgeek changed the title feat: syslog input plugin logs remote IP to source tag Syslog input plugin logs remote IP to source tag Oct 2, 2021
@sspaink sspaink changed the title Syslog input plugin logs remote IP to source tag feat: Syslog input plugin logs remote IP to source tag Oct 6, 2021
@sspaink
Copy link
Contributor

sspaink commented Apr 12, 2022

@thepacketgeek #8454 has been merged, do you have time to rebase this PR now? Thank you!

@thepacketgeek
Copy link
Contributor Author

@thepacketgeek #8454 has been merged, do you have time to rebase this PR now? Thank you!

Yup! I should be able to later this week 👍🏻👍🏻

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @thepacketgeek! The code looks good, I only have one suggestion regarding the tests to centralize the source tag setting instead of doing it in the metric definition.

@srebhan srebhan self-assigned this Jul 12, 2022
@srebhan srebhan added area/syslog plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jul 12, 2022
@thepacketgeek
Copy link
Contributor Author

ci/circleci: test-go-mac test failure seems unrelated:

...
✓  plugins/inputs/syslog (2.105s) (coverage: 90.8% of statements)
...
client: writting packet 4
    graylog_test.go:197: 
        	Error Trace:	graylog_test.go:197
        	Error:      	Received unexpected error:
        	            	error writing message: "{\"_name\":\"test1\",\"_tag1\":\"value1\",\"_value\":1,\"host\":\"static.38.39.177.83.cyberlynk.net\",\"short_message\":\"telegraf\",\"timestamp\":1257894000,\"version\":\"1.1\"}", write tcp 127.0.0.1:50582->127.0.0.1:50581: write: broken pipe
        	Test:       	TestWriteTCP/TLS

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for your effort @thepacketgeek!

@telegraf-tiger
Copy link
Contributor

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jul 20, 2022
@powersj powersj merged commit 08c895d into influxdata:master Jul 20, 2022
@thepacketgeek thepacketgeek deleted the syslog-source-ip branch July 21, 2022 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/syslog feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Record the source IP address of syslog messages
4 participants