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

Missing pipeline_stages definition causes unexpected behaviour #3403

Closed
dannykopping opened this issue Feb 28, 2021 · 0 comments · Fixed by #3404
Closed

Missing pipeline_stages definition causes unexpected behaviour #3403

dannykopping opened this issue Feb 28, 2021 · 0 comments · Fixed by #3404
Assignees
Labels
keepalive An issue or PR that will be kept alive and never marked as stale. type/bug Somehing is not working as expected

Comments

@dannykopping
Copy link
Contributor

dannykopping commented Feb 28, 2021

Describe the bug
When defining a scrape_configs entry, if the pipeline_stages key is omitted then a docker pipeline stage will be created by default.

The definition can be found here:

// DefaultScrapeConfig is the default Config.
var DefaultScrapeConfig = Config{
	PipelineStages: []interface{}{
		map[interface{}]interface{}{
			stages.StageTypeDocker: nil,
		},
	},
}

...

// UnmarshalYAML implements the yaml.Unmarshaler interface.
func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {

	*c = DefaultScrapeConfig

	type plain Config
	if err := unmarshal((*plain)(c)); err != nil {
		return err
	}

	if len(c.JobName) == 0 {
		return fmt.Errorf("job_name is empty")
	}

	return nil
}

To Reproduce
Steps to reproduce the behavior:

  1. Started Loki (HEAD)
  2. Started Promtail (HEAD) with config:
...
scrape_configs:
- job_name: kernel logs
  static_configs:
    - targets:
        - localhost
      labels:
        job: kernel_logs
        __path__: /var/log/kern.log

Promtail is now configured with the docker pipeline stage, and produces errors:

level=info ts=2021-02-28T21:17:33.936395393Z caller=tailer.go:125 component=tailer msg="tail routine: started" path=/var/log/kern.log
ts=2021-02-28T21:17:33.936462167Z caller=log.go:124 component=tailer level=info msg="Seeked /var/log/kern.log - &{Offset:0 Whence:0}"
level=debug ts=2021-02-28T21:17:33.936771177Z caller=json.go:130 component=file_pipeline component=stage type=json msg="failed to unmarshal log line" err="ReadMapCB: expect { or n, but found F, error found in #1 byte of ...|Feb 28 09:0|..., bigger context ...|Feb 28 09:03:30 grafrican kernel: [570410.390357] d|..."
level=debug ts=2021-02-28T21:17:33.936845072Z caller=json.go:130 component=file_pipeline component=stage type=json msg="failed to unmarshal log line" err="ReadMapCB: expect { or n, but found F, error found in #1 byte of ...|Feb 28 09:0|..., bigger context ...|Feb 28 09:03:30 grafrican kernel: [570410.390359] d|..."
level=debug ts=2021-02-28T21:17:33.93690619Z caller=timestamp.go:176 component=file_pipeline msg="extracted data did not contain a timestamp"
level=debug ts=2021-02-28T21:17:33.9368872Z caller=json.go:130 component=file_pipeline component=stage type=json msg="failed to unmarshal log line" err="ReadMapCB: expect { or n, but found F, error found in #1 byte of ...|Feb 28 09:0|..., bigger context ...|Feb 28 09:03:30 grafrican kernel: [570410.390803] d|..."

This is consistent with processing of a docker stage:
image

Expected behavior
Logs to be processed with no pipeline stages, i.e. the scrape_configs entry should behave as if it were provided pipeline_stages: [].

Environment:
Irrelevant.

Screenshots, Promtail config, or terminal output
See above

@dannykopping dannykopping added kind/bug keepalive An issue or PR that will be kept alive and never marked as stale. labels Feb 28, 2021
@dannykopping dannykopping self-assigned this Feb 28, 2021
@chaudum chaudum added the type/bug Somehing is not working as expected label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keepalive An issue or PR that will be kept alive and never marked as stale. type/bug Somehing is not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants