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

[receiver/filelog] Failing to parse sort timestamp #24041

Closed
Mrod1598 opened this issue Jul 7, 2023 · 1 comment · Fixed by #24070
Closed

[receiver/filelog] Failing to parse sort timestamp #24041

Mrod1598 opened this issue Jul 7, 2023 · 1 comment · Fixed by #24070
Assignees
Labels
bug Something isn't working receiver/filelog

Comments

@Mrod1598
Copy link
Contributor

Mrod1598 commented Jul 7, 2023

Component(s)

No response

What happened?

Description

When trying to assign a sort type as timestamp the layout is unable to be parsed.

Steps to Reproduce

Run with a config that uses a timestamp sort type.

Example Config:

    ordering_criteria:
      regex: err\.(?P<time>\d{10})\.log
      sort_by:
        - layout: "%Y%m%d%H"
          regex_key: time
          sort_type: timestamp
          location: UTC

Expected Result

Collector starts and checks the available files.

Actual Result

Running with this fails to start because of the validation being broken through trying to parse a timestamp value that is empty.

Collector version

v0.81.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

receivers:
  filelog/source0:
    encoding: utf-8
    include:
      - ./local/logs/timestampLogsOnly/err.*.log
    ordering_criteria:
      regex: err\.(?P<time>\d{10})\.log
      sort_by:
        - layout: "%Y%m%d%H"
          regex_key: time
          sort_type: timestamp
          location: UTC
        # - sort_type: alphabetical
        #   regex_key: value
    include_file_name: true
    include_file_name_resolved: false
    include_file_path: false
    include_file_path_resolved: false
    max_concurrent_files: 1024
    poll_interval: 200ms
    start_at: beginning

exporters:
  logging/logging: null

service:
  pipelines:
    logs/source0__logging-0:
      receivers:
        - filelog/source0

      exporters:
        - logging/logging

Log output

2023-07-07T14:18:44.497-0400    info    service/telemetry.go:81 Setting up own telemetry...
2023-07-07T14:18:44.498-0400    info    service/telemetry.go:104        Serving Prometheus metrics      {"address": ":8888", "level": "Basic"}
2023-07-07T14:18:44.498-0400    info    [email protected]/exporter.go:275        Development component. May change in the future.        {"kind": "exporter", "data_type": "logs", "name": "logging/logging"}
Error: failed to build pipelines: failed to create "filelog/source0" receiver for data type "logs": parse format %Y%m%d%H: parsing time "" as "2006010215": cannot parse "" as "2006"
2023/07/07 14:18:44 collector server run finished with error: failed to build pipelines: failed to create "filelog/source0" receiver for data type "logs": parse format %Y%m%d%H: parsing time "" as "2006010215": cannot parse "" as "2006"

Additional context

No response

@Mrod1598 Mrod1598 added bug Something isn't working needs triage New item requiring triage labels Jul 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2023

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working receiver/filelog
Projects
None yet
2 participants