47

Is there a way to set Fiddler software to log only "localhost" and not all the web traffic ?

Thanks,

TheBoubou
  • 19,487
  • 54
  • 148
  • 236

3 Answers3

67

Yes you can. Fiddler has a filters option in which you can specify the name of your computer. Here's the steps:

  1. Make sure you have the latest version of fiddler
  2. Click on the "Filters" tab (in the same line of Inspectors).
  3. Click on "Use Filters"
  4. In the text area enter the name of your computer.
  5. Left click on the request area (so it will be saved).

If everything went well, fiddler has a green arrow on the Filters tab. Just browse to the website using your machine name so instead of:

http://localhost/MySite

Go to

http://my-machine-name/MySite

nadavy
  • 1,755
  • 1
  • 18
  • 33
37

I found these ways to only log localhost traffic, either should work.

  1. 'Show only Intranet Hosts', which excludes hostnames with a dot in them

Filters > Show only Intranet Hosts

  1. 'Show only the following Hosts' just specify only to log localhost as below

specify only to log localhost

politus
  • 5,996
  • 1
  • 33
  • 42
2

Here you can find how.

When I test local websites I usually add an entry in the hosts file %systemroot%\System32\drivers\etc\hosts

127.0.0.1   somewebsite

And then I set the bindings on IIS 7 to point to somewebsite
So I can test using "http://somewebsite". Fiddler tracks this.

update

To show only the localhost traffic:
Go to Rules\Customize Rules...
On Handlers class add this menu option

...
    class Handlers
    {

        public static RulesOption("Show Localhost Only")
        var m_ShowLocalHostOnly: boolean = false;
....    

On the function OnBeforeRequest

... static function OnBeforeRequest(oSession: Session) {

    // Hide requests based on target hostname.
if (m_ShowLocalHostOnly && 
            !(oSession.host =="127.0.0.1" 
              || oSession.host =="localhost" 
              || oSession.host =="somewebsite"))
            {
        oSession["ui-hide"]="true";
    }

...

Save this file (Ctrl + S), then choose the new option from the Rules menu.

Adrian Iftode
  • 15,465
  • 4
  • 48
  • 73
  • The problem is not configure to log local website, but NOT log other. When I go on google.com, I see the log. I'd like see ONLY the localhost. – TheBoubou Feb 20 '12 at 08:24
  • When I do this and select the rules in the menu. Every web site is blocked (local and not local) : [Fiddler] The socket connection to stackoverflow.com failed. – TheBoubou Feb 20 '12 at 10:58
  • I don't believe. This is not to avoid processing localhost calls, it's just to hide them on the Fiddler results. You can do the same using the filter instead of the custom script. – m3nda Apr 17 '15 at 20:00
  • @Kris-I Try with `if (m_ShowLocalHostOnly && (oSession.host =="127.0.0.1" || oSession.host =="localhost" || oSession.host =="somewebsite")) { oSession["ui-hide"]="false"; }` – m3nda Apr 17 '15 at 20:01