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

Ability for HAR convert to filter by substrings from the entire URL #650

Closed
SaberStrat opened this issue May 25, 2018 · 5 comments
Closed

Comments

@SaberStrat
Copy link

According to the source of convert.go, the HAR converter currently supports the filters only and skip that only accept a domain string.

It would be cool if the converter could also filter by substrings (maybe regex even) from the entire URL - i.e. parsing the domain, the path and the query. JMeter, for instance, supports this in its Script Recorder.

For example, something like:
k6 convert --only .*.jsp.* --skip .*ads\..*,.*analysics.js.* myfile.har with regex or
k6 convert --only .jsp --skip ads.,analysics.js myfile.har for substring matches.

@na--
Copy link
Member

na-- commented May 25, 2018

I think having a regex filter would be more useful, even if it's a bit more complex for users.

@robingustafsson robingustafsson added this to the v1.0.0 milestone Jul 6, 2018
@na-- na-- removed this from the v1.0.0 milestone Oct 4, 2018
@ppcano
Copy link
Contributor

ppcano commented Jun 5, 2020

k6 deprecated the k6 convert support at #1124. We built a har-to-k6 converter to make k6 independent from this type of logic.

To filter the content of the recorded session, you can use a regex on the Browser Developer Tools to skip domains from the recorded HAR file.

You can read how to filter domains on the Remove third-party content section of the Session recording guide. Please, let us know if there is something we should improve.

Closing the issue.

@ppcano ppcano closed this as completed Jun 5, 2020
@mstoykov
Copy link
Contributor

mstoykov commented Jun 5, 2020

For the record, we then reverted the deprecation in #1268 because har-to-k6 converter still didn't have full feature parity with the current converter, specifically it still doesn't support creating http.batch requests.

@na--
Copy link
Member

na-- commented Jun 5, 2020

@ppcano, browsers are not the only tools that generate HAR files, and it's not always easy to filter out domains or URLs. So, I think a feature in the HAR converter to do it would be a good idea, albeit one with a relatively low priority. So, I created grafana/har-to-k6#39...

@timkrins
Copy link

Because HAR files are just JSON, it is fairly easy to create a script to pre-filter the HAR based on regex.
Here is a gist I wrote that I use with Chrome exported HARs.
https://gist.github.com/timkrins/229bb64598797b41beb70f43381ad6de

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

6 participants