Skip to content

feat(loki.source.syslog): support cisco-specific syslog fields#5165

Merged
jharvey10 merged 20 commits intomainfrom
x1unix/feat/cisco-syslog-support
Jan 5, 2026
Merged

feat(loki.source.syslog): support cisco-specific syslog fields#5165
jharvey10 merged 20 commits intomainfrom
x1unix/feat/cisco-syslog-support

Conversation

@x1unix
Copy link
Member

@x1unix x1unix commented Jan 2, 2026

PR Description

Which issue(s) this PR fixes

This is a followup PR to a previous PR to extend loki.source.syslog component to enable parsing IOS-specific syslog fields.

This PR exposes existing cisco-specific go-syslog parser options to component arguments.

Notes to the Reviewer

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated

BEGIN_COMMIT_OVERRIDE
feat(loki.source.syslog): Support cisco-specific syslog fields (#5165)
END_COMMIT_OVERRIDE

@x1unix x1unix requested review from a team and clayton-cornell as code owners January 2, 2026 00:54
@x1unix x1unix changed the title feat(loki.source.syslog): cisco IOS fields parsing feat(loki.source.syslog): support cisco-specific syslog fields Jan 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2026

💻 Deploy preview available (feat(loki.source.syslog): cisco IOS fields parsing):

@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2026

💻 Deploy preview deleted (feat(loki.source.syslog): support cisco-specific syslog fields).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the loki.source.syslog component to support parsing Cisco IOS-specific syslog fields by exposing configuration options from the underlying go-syslog library. This enables parsing of non-standard Cisco extensions to RFC3164 syslog messages, such as message counters, sequence numbers, hostname fields, and millisecond-precision timestamps.

Key changes:

  • Added rfc3164_cisco_components configuration block with options to enable parsing of Cisco-specific fields
  • Implemented validation to ensure the configuration is only used with RFC3164 format
  • Added experimental feature gating for the new functionality
  • Updated parser implementation to pass Cisco component options through the parsing pipeline

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
internal/loki/promtail/scrapeconfig/config.go Added SyslogRFC3164CiscoComponents struct for Cisco component configuration
internal/converter/internal/promtailconvert/internal/build/syslog.go Updated converter to map Cisco component options from Promtail to Alloy format
internal/component/loki/source/syslog/types_test.go Added comprehensive validation tests for Cisco components configuration
internal/component/loki/source/syslog/types.go Implemented RFC3164CiscoComponents type with validation logic
internal/component/loki/source/syslog/syslog_test.go Refactored experimental feature tests to include Cisco components
internal/component/loki/source/syslog/syslog.go Added experimental feature gate check for Cisco components
internal/component/loki/source/syslog/internal/syslogtarget/transport.go Refactored to use StreamParseConfig and pass Cisco component options to parser
internal/component/loki/source/syslog/internal/syslogtarget/syslogtarget_test.go Added integration tests for RFC3164 Cisco component parsing
internal/component/loki/source/syslog/internal/syslogtarget/syslogtarget.go Added label handling for Cisco-specific message counter and sequence fields
internal/component/loki/source/syslog/internal/syslogtarget/syslogparser/syslogparser_test.go Updated tests to use new StreamParseConfig structure
internal/component/loki/source/syslog/internal/syslogtarget/syslogparser/syslogparser.go Introduced StreamParseConfig struct and Cisco component option handling
internal/component/loki/source/syslog/config/config.go Added RFC3164CiscoComponents struct for component-level configuration
docs/sources/reference/components/loki/loki.source.syslog.md Added comprehensive documentation for Cisco components with device configuration examples and limitations


isEmpty := !sc.Hostname && !sc.MessageCounter && !sc.SecondFractions && !sc.SequenceNumber
if isEmpty {
return errors.New("at least one option in rfc3164_cisco_components has to be enabled")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we tweak this error to better align with either of the user actions that are required? They must either enable one of these options or set enable_all to true.

Do we have precedence in Alloy for the enable_all behavior like this? I know for something like the unix exporter, we have a default set of things that get used if nothing is provided, which can be overridden in a couple of different ways.

If we can, it would be great to provide a set of sensible defaults for users. I don't have the domain knowledge to know if "all" of them being on by default would be appropriate, but perhaps something to consider.

Copy link
Member Author

@x1unix x1unix Jan 4, 2026

Choose a reason for hiding this comment

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

Do we have precedence in Alloy for the enable_all behavior like this? I know for something like the unix exporter, we have a default set of things that get used if nothing is provided, which can be overridden in a couple of different ways.

Yes, enable_all takes priority over all other flags:

parseCfg.RFC3164CiscoComponents = &syslogparser.RFC3164CiscoComponents{
	MessageCounter:  ciscoCfg.EnableAll || ciscoCfg.MessageCounter,
	SequenceNumber:  ciscoCfg.EnableAll || ciscoCfg.SequenceNumber,
	CiscoHostname:   ciscoCfg.EnableAll || ciscoCfg.Hostname,
	SecondFractions: ciscoCfg.EnableAll || ciscoCfg.SecondFractions,
}

If we can, it would be great to provide a set of sensible defaults for users. I don't have the domain knowledge to know if "all" of them being on by default would be appropriate, but perhaps something to consider.

The problem is that parser settings are very config-specific and should match the IOS configuration (this mentioned in the parser docs):

Important: Your parser configuration must match your Cisco device configuration. The parser cannot auto-detect which components are present because they share similar formats (mostly digits followed by colon).

Copy link
Contributor

Choose a reason for hiding this comment

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

As per our discussion on Slack, I understand this better and think this aligns well with the device configuration semantics. enable_all is a convenience for users who use everything in the supported set, and if this set becomes large in the future, we can always revisit the way these are specified.

@x1unix x1unix force-pushed the x1unix/feat/cisco-syslog-support branch from 2b882cb to 73b8004 Compare January 5, 2026 14:03
@x1unix x1unix requested a review from jharvey10 January 5, 2026 15:30
@x1unix x1unix force-pushed the x1unix/feat/cisco-syslog-support branch from 73b8004 to 8362ca8 Compare January 5, 2026 17:09
x1unix and others added 2 commits January 5, 2026 12:37
Co-authored-by: Joe Harvey <51208233+jharvey10@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@x1unix x1unix force-pushed the x1unix/feat/cisco-syslog-support branch from 8362ca8 to 4463604 Compare January 5, 2026 17:37
@jharvey10 jharvey10 merged commit 3230ba0 into main Jan 5, 2026
60 of 65 checks passed
@jharvey10 jharvey10 deleted the x1unix/feat/cisco-syslog-support branch January 5, 2026 22:18
@grafana-alloybot grafana-alloybot bot mentioned this pull request Jan 5, 2026
blewis12 pushed a commit that referenced this pull request Jan 6, 2026
This is a followup PR to a [previous PR](#5140) to extend `loki.source.syslog` component to enable parsing IOS-specific syslog fields.

This PR exposes existing cisco-specific go-syslog [parser options](https://github.com/leodido/go-syslog/tree/develop/rfc3164#cisco-device-configuration) to component arguments.
@clayton-cornell clayton-cornell added the type/docs Docs Squad label across all Grafana Labs repos label Jan 6, 2026
blewis12 pushed a commit that referenced this pull request Jan 6, 2026
This is a followup PR to a [previous PR](#5140) to extend `loki.source.syslog` component to enable parsing IOS-specific syslog fields.

This PR exposes existing cisco-specific go-syslog [parser options](https://github.com/leodido/go-syslog/tree/develop/rfc3164#cisco-device-configuration) to component arguments.
blewis12 pushed a commit that referenced this pull request Jan 7, 2026
This is a followup PR to a [previous PR](#5140) to extend `loki.source.syslog` component to enable parsing IOS-specific syslog fields.

This PR exposes existing cisco-specific go-syslog [parser options](https://github.com/leodido/go-syslog/tree/develop/rfc3164#cisco-device-configuration) to component arguments.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age type/docs Docs Squad label across all Grafana Labs repos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants