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

adding timezone support to logparser timestamps #2882

Merged
merged 1 commit into from
Jun 5, 2017

Conversation

sebito91
Copy link
Contributor

@sebito91 sebito91 commented Jun 3, 2017

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

Copy link
Contributor

@danielnelson danielnelson left a comment

Choose a reason for hiding this comment

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

Looks great, just a few tweaks needed.

@@ -7,15 +7,17 @@ regex patterns.
### Configuration:

```toml
[[inputs.logparser]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep this line

custom_pattern_files = []
## Custom patterns can also be defined here. Put one pattern per line.

## Custom patterns can also be defined here. Put one pattern per line.
Copy link
Contributor

Choose a reason for hiding this comment

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

Use 2 space indention in here

@@ -155,9 +167,16 @@ func (p *Parser) Compile() error {
p.Measurement = "logparser_grok"
}

p.loc, err = time.LoadLocation(p.Timezone)
if err != nil {
log.Printf("D! improper timezone supplied (%s), setting loc to UTC", p.Timezone)
Copy link
Contributor

Choose a reason for hiding this comment

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

Log this as W!

## 1. Local -- interpret based on machine localtime
## 2. "Canada/Eastern" -- Unix TZ values like those found in https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
## 3. UTC -- or blank/unspecified, will return timestamp in UTC
timezone = "Canada/Eastern"
Copy link
Contributor

Choose a reason for hiding this comment

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

2 space indention

@sebito91
Copy link
Contributor Author

sebito91 commented Jun 5, 2017

Updated with requested changes. Apologies for the whitespace issues, new vimrc config :/

@danielnelson danielnelson merged commit 035905d into influxdata:master Jun 5, 2017
@sebito91 sebito91 deleted the timezone branch June 13, 2017 07:32
jeichorn pushed a commit to jeichorn/telegraf that referenced this pull request Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants