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 : Epoch convertion impossible with SYSLOGTIMESTAMP Grok pattern #3379

Closed
wolfyzvf opened this issue Oct 23, 2017 · 2 comments · Fixed by #4190
Closed

Logparser : Epoch convertion impossible with SYSLOGTIMESTAMP Grok pattern #3379

wolfyzvf opened this issue Oct 23, 2017 · 2 comments · Fixed by #4190
Labels
area/tail feature request Requests for new plugin and for new features to existing plugins
Milestone

Comments

@wolfyzvf
Copy link

Bug report

Relevant telegraf.conf:

[[inputs.logparser]]
files = ["/root/samples/*mail.log"]
from_beginning = true

[inputs.logparser.grok]
patterns = ["%{SYSLOGTIMESTAMP:timestamp:ts-“Mon Jan 2 15:04:05”} %{SYSLOGHOST:hostname} mta-in/milter[%{MILTER_PROCESSID}]: %{POSTFIX_QUEUEID:postfix_queue_id}: from=<%{DATA:postfix_from}>, firstto=<%{DATA:postfix_firstto}>, nrcpt=%{DATA:postfix_nrcpt}, size=%{DATA:postfix_msg_size}, score=%{DATA:score}, state=%{DATA:state:int}, status=%{DATA:status:tag}, level=%{DATA:level}, actions=%{DATA:actions}, subject="%{DATA:subject}", cause="%{DATA:cause}""]

Name of the outputted measurement name.

measurement = “test”

custom_patterns = ‘’‘
POSTFIX_QUEUEID ([0-9A-F]{6,}|[0-9a-zA-Z]{15,})
MILTER_PROCESSID ([0-9]{5,})
’’’

System info:

  • Telegraf v1.4.2 (git: release-1.4 0cc5fc0)
  • InfluxDB 1.3.6-1
  • Docker official image

Steps to reproduce:

  1. Deploy Telegraf using docker with the
  2. Inject an existing log in SYSLOGTIMESTAMP format
    For ex. Sep 25 08:27:29 mailhost postfix/cleanup[17659]: ABFF15C..
  3. The time is not correctly calculated.

Expected behavior:

The syslog_timestamp should be converted into time in Influxdb

Actual behavior:

As the year is missing, As Telegraf can't find the year he set it to 0 which generate a wrong time in influxdb

Additional info:

[Include gist of relevant config, logs, etc.]

Feature Request

Opening a feature request kicks off a discussion.

Proposal:

Like the timezone option we should be able to set manually the year.
Assuming automatically the year could cause some trouble when we change of it.
if a person has more than 2-3 years of logs to inject into influxdb he should pass this option in each logparser.

Current behavior:

Telegraf assume automatically 0 has year if it's not provided

Desired behavior:

By setting manually the date, Telegraf will be able to build the correct time in influxdb.

Use case: [Why is this important (helps with prioritizing requests)]

This is a standard output for the syslog, this pattern should be recognize per default as many solution use it.

Forum Discussion

https://community.influxdata.com/t/custom-timestamp-for-syslogtimestamp-and-telegraf/2798/

@danielnelson danielnelson added area/tail feature request Requests for new plugin and for new features to existing plugins labels Oct 24, 2017
@danielnelson danielnelson changed the title Logparser : Epox convertion impossible with SYSLOGTIMESTAMP Grok pattern Logparser : Epoch convertion impossible with SYSLOGTIMESTAMP Grok pattern Oct 24, 2017
@EduardoOliveira
Copy link

Any news or workaround?
Thanks

@danielnelson
Copy link
Contributor

I added a new timestamp format for parsing syslog timestamps. You can use it with%{SYSLOGTIMESTAMP:timestamp:ts-syslog} on the nightly builds (give them a day to incorporate the change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tail feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants