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

logparser plugin panics with integer divide by zero error #3438

Closed
russorat opened this issue Nov 6, 2017 · 1 comment
Closed

logparser plugin panics with integer divide by zero error #3438

russorat opened this issue Nov 6, 2017 · 1 comment
Assignees
Labels
area/tail bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Milestone

Comments

@russorat
Copy link
Contributor

russorat commented Nov 6, 2017

Bug report

System info:

Telegraf v1.5.0~26ccc1f2
Mac OS X 10.13

Steps to reproduce:

  1. Add config and start telegraf
  2. Opening iTunes on my mac causes the log lines to error out. Not sure if you could manually send them.

telegraf.conf

[[inputs.logparser]]
    files = ["/var/log/system.log"]
    from_beginning = false
    [inputs.logparser.grok]
        patterns = [
          '%{APPLE_SYSLOG_TIME_SHORT:timestamp:ts-"Jan 2 15:04:05"} %{HOSTNAME} %{APP_NAME:app_name}\[%{NUMBER:pid:int}\]%{GREEDYDATA:message}']
        measurement = "apple_syslog"
        ## Custom patterns can also be defined here. Put one pattern per line.
        custom_patterns = '''
          APPLE_SYSLOG_TIME_SHORT %{MONTH} +%{MONTHDAY} %{TIME}
          APP_NAME [a-zA-Z0-9\.]+
        '''

log lines trying to parse

Nov  6 13:56:52 --- last message repeated 1 time ---
Nov  6 13:56:57 rsavage com.apple.xpc.launchd[1] (com.apple.WebKit.Networking.5690FB7B-ED1E-46A0-8D0E-BC3F1CDF5191[6467]): Service exited with abnormal code: 1
Nov  6 13:57:03 rsavage iTunes[6504]: objc[6504]: Class AMSupportURLConnectionDelegate is implemented in both /System/Library/PrivateFrameworks/EmbeddedOSInstall.framework/Versions/A/EmbeddedOSInstall (0x7fffa594e748) and /System/Library/PrivateFrameworks/MobileDevice.framework/MobileDevice (0x107e67008). One of the two will be used. Which one is undefined.
Nov  6 13:57:03 rsavage iTunes[6504]: info> Scale factor of main display = 2.0
Nov  6 13:57:05 rsavage com.apple.WebKit.WebContent[6554]: iTunes WebBundle - Object descriptor was null.

error message

panic: runtime error: integer divide by zero

goroutine 16 [running]:
github.com/influxdata/telegraf/plugins/inputs/logparser/grok.(*tsModder).tsMod(0xc420116230, 0x0, 0xffffffffffb6f02f, 0x0, 0x0, 0x0, 0x0)
	/Users/rsavage/go/src/github.com/influxdata/telegraf/plugins/inputs/logparser/grok/grok.go:458 +0x67d
github.com/influxdata/telegraf/plugins/inputs/logparser/grok.(*Parser).ParseLine(0xc4201260c0, 0xc42001ba40, 0x4e, 0x0, 0xc42076a090, 0xc4201364c0, 0x1)
	/Users/rsavage/go/src/github.com/influxdata/telegraf/plugins/inputs/logparser/grok/grok.go:329 +0x1dda
github.com/influxdata/telegraf/plugins/inputs/logparser.(*LogParserPlugin).parser(0xc4201f1c20)
	/Users/rsavage/go/src/github.com/influxdata/telegraf/plugins/inputs/logparser/logparser.go:270 +0x25e
created by github.com/influxdata/telegraf/plugins/inputs/logparser.(*LogParserPlugin).Start
	/Users/rsavage/go/src/github.com/influxdata/telegraf/plugins/inputs/logparser/logparser.go:164 +0x581
@danielnelson danielnelson added area/tail bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf labels Nov 7, 2017
@danielnelson
Copy link
Contributor

This is related to #3379. Since there is no year in syslog the default year in Go is used (year 1), and the timestamp incrementer for duplicate points does not handle times before the epoch correctly.

@Ayrdrie Ayrdrie self-assigned this Jun 15, 2018
@Ayrdrie Ayrdrie mentioned this issue Jun 22, 2018
2 tasks
@danielnelson danielnelson added this to the 1.8.0 milestone Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tail bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Projects
None yet
Development

No branches or pull requests

3 participants