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

opentelementry receiver log from file and export to opensearch #34566

Open
NamanGajjar26 opened this issue Aug 9, 2024 · 3 comments
Open

opentelementry receiver log from file and export to opensearch #34566

NamanGajjar26 opened this issue Aug 9, 2024 · 3 comments

Comments

@NamanGajjar26
Copy link

Component(s)

exporter/opensearch

What happened?

Description

hi there
i am try to send receivers log file from this path (/app/log/naman/namanlog.log) and export this log to opensearch and make new index (demo1-index) get this log opensearch

Steps to Reproduce

     ` config:
        receivers:    
          filelog:
            include: ["/app/log/naman/namanlog.log"] 
            start_at: beginning      
           
        processors:
          batch:
            timeout: 60s
            send_batch_max_size: 10000
      
        extensions:
          basicauth/client:
            client_auth:
              username: admin
              password: TadhakDev01
          health_check:
            endpoint: ${env:MY_POD_IP}:13133
      
        exporters: 
          logging:
            loglevel: debug  
          opensearch:
            logs_index: otel-index-opensearch
            http:
              endpoint: http://opensearch-cluster-master-headless.myopensearch.svc.cluster.local:9200
              auth:
                authenticator: basicauth/client
              tls:
               insecure: true
      
        service:    
          extensions:
            - basicauth/client
            - health_check
          pipelines:           
            logs:
              receivers: [filelog]        
              exporters: [opensearch]`

Expected Result

i want to get this log message in opensearch using opentelemetry
{"@timestamp":"2024-08-09T13:33:12.406Z","flb-key":"kube.custommvc.app.log.naman.namanlog.log","Timestamp":"2024-08-09T13:33:12.1972500+00:00","Level":"Error","MessageTemplate":"time_error_new2","TraceId":"b6475c2b94d380210de53197e5c482e8","SpanId":"53a55dc04afce4b5","Properties":{"Method":"errorlog","IndiaTime":"2024-08-09T19:03:12.1972334","UtcTimestamp":"2024-08-09T13:33:12.1972475Z","Timestamp":"2024-08-09T13:33:12.1972429+00:00"}}

Actual Result

there are show error in opentelemetry error
error reader/reader.go:140 process: %w {"kind": "receiver", "name": "filelog", "data_type": "logs", "component": "fileconsumer", "path": "/app/log/naman/namanlog.log", "error": "failed to process the docker log: move: field log does not exist"}

Screenshot from 2024-08-09 19-16-29

Collector version

latest

Environment information

Environment

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

OpenTelemetry Collector configuration

receivers:    
              filelog:
                include: ["/app/log/naman/namanlog.log"] 
                start_at: beginning      
               
            processors:
              batch:
                timeout: 60s
                send_batch_max_size: 10000
          
            extensions:
              basicauth/client:
                client_auth:
                  username: admin
                  password: TadhakDev01
              health_check:
                endpoint: ${env:MY_POD_IP}:13133
          
            exporters: 
              logging:
                loglevel: debug  
              opensearch:
                logs_index: otel-index-opensearch
                http:
                  endpoint: http://opensearch-cluster-master-headless.myopensearch.svc.cluster.local:9200
                  auth:
                    authenticator: basicauth/client
                  tls:
                   insecure: true          
            service:    
              extensions:
                - basicauth/client
                - health_check
              pipelines:           
                logs:
                  receivers: [filelog]        
                  exporters: [opensearch]

Log output

github.com/open-telemetry/opentelemetry-collector-contrib/pkg/[email protected]/fileconsumer/internal/reader/reader.go:140
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer.(*Manager).consume.func1
 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/[email protected]/fileconsumer/file.go:160
2024-08-09T13:36:29.945Z error reader/reader.go:140 process: %w {"kind": "receiver", "name": "filelog", "data_type": "logs", "component": "fileconsumer", "path": "/app/log/naman/namanlog.log", "error": "failed to process the docker log: move: field log does not exist"}
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/reader.(*Reader).ReadToEnd
 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/[email protected]/fileconsumer/internal/reader/reader.go:140
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer.(*Manager).consume.func1
 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/[email protected]/fileconsumer/file.go:160
2024-08-09T13:36:29.945Z error reader/reader.go:140 process: %w {"kind": "receiver", "name": "filelog", "data_type": "logs", "component": "fileconsumer", "path": "/app/log/naman/namanlog.log", "error": "failed to process the docker log: move: field log does not exist"}
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/reader.(*Reader).ReadToEnd
 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/[email protected]/fileconsumer/internal/reader/reader.go:140
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer.(*Manager).consume.func1
 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/[email protected]/fileconsumer/file.go:160
2024-08-09T13:36:29.945Z error reader/reader.go:140 process: %w {"kind": "receiver", "name": "filelog", "data_type": "logs", "component": "fileconsumer", "path": "/app/log/naman/namanlog.log", "error": "failed to process the docker log: move: field log does not exist"}
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/reader.(*Reader).ReadToEnd
 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/[email protected]/fileconsumer/internal/reader/reader.go:140
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer.(*Manager).consume.func1
 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/[email protected]/fileconsumer/file.go:160
2024-08-09T13:36:29.945Z error reader/reader.go:140 process: %w {"kind": "receiver", "name": "filelog", "data_type": "logs", "component": "fileconsumer", "path": "/app/log/naman/namanlog.log", "error": "failed to process the docker log: move: field log does not exist"}
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/reader.(*Reader).ReadToEnd
 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/[email protected]/fileconsumer/internal/reader/reader.go:140
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer.(*Manager).consume.func1
 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/[email protected]/fileconsumer/file.go:160

Additional context

No response

@NamanGajjar26 NamanGajjar26 added bug Something isn't working needs triage New item requiring triage labels Aug 9, 2024
Copy link
Contributor

github-actions bot commented Aug 9, 2024

Pinging code owners:

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

@NamanGajjar26 NamanGajjar26 changed the title opentelementry to send log in opensearch opentelementry receiver log and export in opensearch Aug 9, 2024
@NamanGajjar26 NamanGajjar26 changed the title opentelementry receiver log and export in opensearch opentelementry receiver log from file and export to opensearch Aug 9, 2024
@NamanGajjar26
Copy link
Author

i am get this two error below
how to solved this error

error [email protected]/logger.go:36 Request failed. {"kind": "exporter", "data_type": "logs", "name": "opensearch", "path": "/_bulk", "method": "POST", "duration": 0.001234298, "reason": "net/http: HTTP/1.x transport connection broken: http: ContentLength=22616 with Body length 0"}

error exporterhelper/common.go:296 Exporting failed. Rejecting data. {"kind": "exporter", "data_type": "logs", "name": "opensearch", "error": "not retryable error: Permanent error: Permanent error: flush: net/http: HTTP/1.x transport connection broken: http: ContentLength=22616 with Body length 0\nPermanent error: Permanent error: flush: net/http: HTTP/1.x transport connection broken: http: ContentLength=22616 with Body length 0", "rejected_items": 12}

and i am config in yml like below

  `config:
    receivers:    
      filelog:
        include: ["/app/log/naman/namanlog.log"] 
        start_at: end
        operators:
          - type: regex_parser
            regex: '"Timestamp":"(?P<Timestamp>[^"]+)","Level":"(?P<Level>[^"]+)","MessageTemplate":"(?P<MessageTemplate>[^"]+)","TraceId":"(?P<TraceId>[^"]+)","SpanId":"(?P<SpanId>[^"]+)","Properties":{(?P<Properties>.*)}'
       
    processors:
      batch:
        timeout: 60s
        send_batch_max_size: 10000
  
    extensions:
      basicauth/client:
        client_auth:
          username: admin
          password: TadhakDev01
      health_check:
        endpoint: ${env:MY_POD_IP}:13133
  
    exporters: 
      logging:
        loglevel: debug  
      opensearch:
        logs_index: otel-index-opensearch
        http:
          endpoint: http://opensearch-cluster-master-headless.myopensearch.svc.cluster.local:9200
          auth:
            authenticator: basicauth/client
          tls:
           insecure: true
           insecure_skip_verify: true 
          timeout: 60s
     
    service:
      telemetry:
        logs:
          level: debug    
      extensions:
        - basicauth/client
        - health_check
      pipelines:           
        logs:
          receivers: [filelog]        
          exporters: [opensearch]`

@atoulme atoulme added waiting-for-code-owners and removed needs triage New item requiring triage labels Oct 12, 2024
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants