Skip to content

[CDTOOL-1699] Add Log Explorer and Insights CLI commands - #1887

Open
philippschulte wants to merge 1 commit into
fastly:mainfrom
philippschulte:pschulte/cdtool-1699_log-explorer-insights-cli
Open

[CDTOOL-1699] Add Log Explorer and Insights CLI commands#1887
philippschulte wants to merge 1 commit into
fastly:mainfrom
philippschulte:pschulte/cdtool-1699_log-explorer-insights-cli

Conversation

@philippschulte

Copy link
Copy Markdown
Member

Change summary

Adds fastly service logging log-explorer and fastly service logging insights commands with service scoping, filtering, pagination, visualization options, JSON/human-readable output, and test coverage.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  • Does your submission pass tests?

@philippschulte

Copy link
Copy Markdown
Member Author

This pull request depends on fastly/go-fastly#851 and fastly/go-fastly#853.

@philippschulte
philippschulte force-pushed the pschulte/cdtool-1699_log-explorer-insights-cli branch from 0aa1998 to c910597 Compare August 24, 2026 21:07
@philippschulte
philippschulte marked this pull request as ready for review August 24, 2026 21:33
@philippschulte
philippschulte requested a review from a team as a code owner August 24, 2026 21:33
@philippschulte
philippschulte requested review from jedisct1, kpfleming and rcaril and removed request for jedisct1 August 24, 2026 21:33

@kpfleming kpfleming left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall this looks good, but I've requested some changes for consistency with other commands in the CLI.

Dst: &c.serviceName.Value,
})
c.CmdClause.Flag("domain", "Limit data to the specified request domain").Action(c.domain.Set).StringVar(&c.domain.Value)
c.CmdClause.Flag("domain-exact-match", "Treat --domain as an exact match instead of a suffix match [true, false]").Action(c.domainExactMatch.Set).StringVar(&c.domainExactMatch.Value)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The CLI is not consistent in how it handles flags like this, but my preference would be for this to be a bare flag (no parameter provided), which sets the domain-exact-match behavior to true. Since the default is false, there's no need to provide a flag which can set it to false, since the only way it can ever be true is for a second (earlier) flag on the command line to have set it to true. If that change is made, then it can be a boolean in the struct instead of a string.

})
c.CmdClause.Flag("filter", "Filter in FIELD,OPERATOR,VALUE format (repeatable)").StringsVar(&c.filters)
c.CmdClause.Flag("limit", "Maximum number of rows to return (up to 100)").Action(c.limit.Set).IntVar(&c.limit.Value)
c.CmdClause.Flag("cursor", "Pagination cursor from a previous response").Action(c.cursor.Set).StringVar(&c.cursor.Value)

@kpfleming kpfleming Aug 25, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is standard practice for commands in the CLI; pagination should be hidden from the user, either by absorbing all the pages in the CLI itself, or doing that in go-fastly. It's not important where the de-pagination occurs, but we shouldn't require CLI users to have to extract cursor values from the output and supply them to subsequent commands. In particular, the sequence of commands would have to have the same filter, start, and end parameters in order for the cursor to be valid. Since the command already offers start and end, the user can decide how much output they want.

This means we don't need limit or cursor in this command, since the user can get the desired behavior directly as long as the de-pagination is handled for them.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants