It depends on the tone, style, and whether or not your writing a genre novel or a literary novel. I'm currently writing what will be a very long literary novel told in the first person by a man in a mental hospital set in the near future. In the story commercialism has gotten so bad that basically everything is a billboard. Now, the tone toes the line between simple frustration and anger...for large...and I do mean LARGE...sections of the book. Anyway, rambling vs. relevant details...
I want the story to feel like it's been told, after the fact, by someone who's remembering it as he relates it to the reader. There are times when the narrator tells part of the story and forgets the name of someone who's name wouldn't even be relevant anyway or he goes on for a paragraph or two about something he was reminded about at the time...but it is all relevant to the story, in some way. Throughout the book the narrator explains everything from his birth up to the point he entered the institution and then the story continues a short bit beyond that to the end...and while doing so, sometimes things are not always in the order they happened. However, enough details are given that you can piece things together if you pay attention. You don't even have to pay that super close of attention either. Anyway, a lot of the book feels like the narrator could end about half of the paragraphs with "...but I digress."
Even though this does feel like rambling and in my head I joke that's I'm writing the "long winded story of a rambling mental patient" it's only partially true. It's clear the character understands how to tell a story, he just doesn't remember every single bit in exactly the same way it would be told in a well edited purposefully written third person narrative. And that works for this narrative...very well in fact. The story has a "hey, you wanna hear a story?" feel running throughout. In fact, the story I'm telling would feel almost contrived if it didn't. You'd feel like you were being lied to by an ***hole who's more interested in jerking you around and laughing at you while he wastes your time than telling you an interesting story. So, the "...let's see here..." feel that it has works great.
The point is...what can feel rambling in one narrative will work great in another. If you're telling a literary novel you're expected to do things that in a genre novel would be considered rambling. In a genera novel you're expected to get to the point and move the plot along in such a way that if you did so in a literary novel you'd be told to go do some research and rewrite the story. Also, it depends on the tone pacing, and context within the story. If the pacing is slower then more details will benefit the reader. If the pacing is fast then less details benefit the reader. How long do you spend relating the main character's issues with his socks in the morning? My book opens with about three page of it. But, according to people who've read it...it's hilarious, interesting, and opens the book very well...especially because the MC is a mental patient and sometimes they expend large amounts of brain power on mundane details.
So, if you think you might be rambling then read what leads up to the "rambling" section and then a bit afterwards and notice how it felt to read it. Did you get bored, was it interesting but "why was it there?", etc. I always ask myself "if I hadn't written this, how would I feel about it?" (you know, reading as a book I'd bought at a bookstore and committed to reading) and then I have my answer. Sometimes a re-write of something is necessary and sometimes I'm surprised that I actually like what I have.
Now, if you're doing it for comedic purposes and it's actually funny to someone other than just yourself...you can break ALL the rules in any number of ways (within reason of course), but if you're writing something meant to be taken seriously, at least using the rules as a guide is the best way to go about it.
Remember: tone, context, pacing, and relevance to the plot will dictate how many words you can devote to whatever it is you want to write about within the greater context of your story.