Repository navigation
feat(landing): log parsing guide #1578
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
Changes from all commits
8a77b16
5d1cb98
5a5c325
a8109ad
6305d85
92bcc7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # debug.yaml: print parsed records instead of exporting them | ||
| exporters: | ||
| debug: | ||
| verbosity: detailed | ||
|
|
||
| service: | ||
| pipelines: | ||
| logs: | ||
| exporters: [debug] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| receivers: | ||
| file_log/app: | ||
| include: [/var/log/app/app.log] | ||
| resource: | ||
| service.name: app | ||
| operators: | ||
| - type: json_parser | ||
| timestamp: | ||
| parse_from: attributes.ts | ||
| layout_type: gotime | ||
| layout: "2006-01-02T15:04:05Z07:00" | ||
| severity: | ||
| parse_from: attributes.level | ||
| - type: move | ||
| from: attributes.msg | ||
| to: body | ||
| on_error: send_quiet | ||
|
|
||
| processors: | ||
| batch: {} | ||
|
|
||
| exporters: | ||
| otlp_http/maple: | ||
| endpoint: https://ingest.maple.dev | ||
| compression: gzip | ||
| headers: | ||
| x-maple-ingest-key: ${env:MAPLE_INGEST_KEY} | ||
|
|
||
| service: | ||
| pipelines: | ||
| logs: | ||
| receivers: [file_log/app] | ||
| processors: [batch] | ||
| exporters: [otlp_http/maple] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| receivers: | ||
| file_log/worker: | ||
| include: [/var/log/worker/worker.log] | ||
| resource: | ||
| service.name: worker | ||
| operators: | ||
| - type: key_value_parser | ||
| timestamp: | ||
| parse_from: attributes.time | ||
| layout_type: gotime | ||
| layout: "2006-01-02T15:04:05Z07:00" | ||
| severity: | ||
| parse_from: attributes.level | ||
|
|
||
| processors: | ||
| batch: {} | ||
|
|
||
| exporters: | ||
| otlp_http/maple: | ||
| endpoint: https://ingest.maple.dev | ||
| compression: gzip | ||
| headers: | ||
| x-maple-ingest-key: ${env:MAPLE_INGEST_KEY} | ||
|
|
||
| service: | ||
| pipelines: | ||
| logs: | ||
| receivers: [file_log/worker] | ||
| processors: [batch] | ||
| exporters: [otlp_http/maple] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| receivers: | ||
| file_log/checkout: | ||
| include: [/var/log/checkout/app.log] | ||
| resource: | ||
| service.name: checkout | ||
| # A new entry starts at a line beginning with a date. Other lines, such | ||
| # as stack frames, are appended to the entry before them. | ||
| multiline: | ||
| line_start_pattern: '^\d{4}-\d{2}-\d{2} ' | ||
| operators: | ||
| - type: regex_parser | ||
| regex: '(?s)^(?P<time>\S+ \S+) (?P<level>[A-Z]+)\s+\[(?P<thread>[^\]]+)\] (?P<logger>\S+) - (?P<message>.*)$' | ||
| timestamp: | ||
| parse_from: attributes.time | ||
| layout: "%Y-%m-%d %H:%M:%S,%L" | ||
| location: UTC | ||
| severity: | ||
| parse_from: attributes.level | ||
|
|
||
| processors: | ||
| batch: {} | ||
|
|
||
| exporters: | ||
| otlp_http/maple: | ||
| endpoint: https://ingest.maple.dev | ||
| compression: gzip | ||
| headers: | ||
| x-maple-ingest-key: ${env:MAPLE_INGEST_KEY} | ||
|
|
||
| service: | ||
| pipelines: | ||
| logs: | ||
| receivers: [file_log/checkout] | ||
| processors: [batch] | ||
| exporters: [otlp_http/maple] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| receivers: | ||
| file_log/nginx: | ||
| include: [/var/log/nginx/access.log] | ||
| resource: | ||
| service.name: nginx | ||
| operators: | ||
| - type: regex_parser | ||
| regex: '^(?P<client_address>\S+) \S+ \S+ \[(?P<time_local>[^\]]+)\] "(?P<method>[A-Z]+) (?P<path>[^ ?"]+)[^ "]* HTTP/[0-9.]+" (?P<status>\d{3}) (?P<body_bytes>\d+|-) "[^"]*" "(?P<user_agent>[^"]*)"$' | ||
| timestamp: | ||
| parse_from: attributes.time_local | ||
| layout: "%d/%b/%Y:%H:%M:%S %z" | ||
| severity: | ||
| parse_from: attributes.status | ||
| overwrite_text: true | ||
| mapping: | ||
| info: | ||
| - min: 100 | ||
| max: 399 | ||
| warn: 4xx | ||
| error: 5xx | ||
| # Operators run top to bottom, so the renames come after the parser | ||
| # that creates the fields. Dots are not allowed in group names. | ||
| - type: move | ||
| from: attributes.client_address | ||
| to: attributes["client.address"] | ||
| on_error: send_quiet | ||
| - type: move | ||
| from: attributes.method | ||
| to: attributes["http.request.method"] | ||
| on_error: send_quiet | ||
| - type: move | ||
| from: attributes.path | ||
| to: attributes["url.path"] | ||
| on_error: send_quiet | ||
| - type: move | ||
| from: attributes.status | ||
| to: attributes["http.response.status_code"] | ||
| on_error: send_quiet | ||
| - type: move | ||
| from: attributes.body_bytes | ||
| to: attributes["http.response.body.size"] | ||
| on_error: send_quiet | ||
| - type: move | ||
| from: attributes.user_agent | ||
| to: attributes["user_agent.original"] | ||
| on_error: send_quiet | ||
| - type: remove | ||
| field: attributes.time_local | ||
| on_error: send_quiet | ||
|
|
||
| processors: | ||
| transform/nginx: | ||
| error_mode: ignore | ||
| log_statements: | ||
| - delete_key(log.attributes, "http.response.body.size") where log.attributes["http.response.body.size"] == "-" | ||
| - set(log.attributes["http.response.status_code"], Int(log.attributes["http.response.status_code"])) where log.attributes["http.response.status_code"] != nil | ||
| - set(log.attributes["http.response.body.size"], Int(log.attributes["http.response.body.size"])) where log.attributes["http.response.body.size"] != nil | ||
| batch: {} | ||
|
|
||
| exporters: | ||
| otlp_http/maple: | ||
| endpoint: https://ingest.maple.dev | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Make the ingest endpoint match the Maple organization’s region. If a reader uses an EU organization’s ingest key, 🤖 Prompt for AI Agents |
||
| compression: gzip | ||
| headers: | ||
| x-maple-ingest-key: ${env:MAPLE_INGEST_KEY} | ||
|
|
||
| service: | ||
| pipelines: | ||
| logs: | ||
| receivers: [file_log/nginx] | ||
| processors: [transform/nginx, batch] | ||
| exporters: [otlp_http/maple] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| receivers: | ||
| file_log/syslog: | ||
| include: [/var/log/remote/hosts.log] | ||
| resource: | ||
| service.name: syslog | ||
| operators: | ||
| - type: syslog_parser | ||
| protocol: rfc5424 | ||
|
|
||
| processors: | ||
| batch: {} | ||
|
|
||
| exporters: | ||
| otlp_http/maple: | ||
| endpoint: https://ingest.maple.dev | ||
| compression: gzip | ||
| headers: | ||
| x-maple-ingest-key: ${env:MAPLE_INGEST_KEY} | ||
|
|
||
| service: | ||
| pipelines: | ||
| logs: | ||
| receivers: [file_log/syslog] | ||
| processors: [batch] | ||
| exporters: [otlp_http/maple] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Preserve access-log records across Collector restarts.
The filelog receiver defaults to
start_at: endand keeps offsets only in memory. If Nginx writes records while the Collector is stopped, the restarted Collector skips those records. A pre-existing sample file is also skipped until new lines arrive. Setstart_at: beginningand configure persistent filelog offset storage so the receiver can catch up without rereading the whole file on each restart. (raw.githubusercontent.com)🤖 Prompt for AI Agents