anyaudio / anyaudio-server

:musical_note: Simple server to search youtube and give direct audio download and stream links
91 stars 19 forks source link

Remove User-Agent Ruby from API logs #88

Closed aviaryan closed 8 years ago

aviaryan commented 8 years ago

User-Agent = Ruby seems to be some internal system call and it highly pollutes our logs. Right now, the last 18 logs are from User-Agent Ruby . So I suggest we should blacklist it and not record it. I don't think any other API call will have UserAgent as "Ruby". So it should be pretty safe to do so.

@singhpratyush views ??

singhpratyush commented 8 years ago

We can ignore it while logging -

def log_api_call(obj):
    if obj.user_agent == 'Ruby':
        return
    ...

and delete all existing instances in database -

delete from api_log where user_agent = 'Ruby';

In my opinion too it would be safe but first we should try to know about what it actually is. Till then we can just change the way we are displaying logs -

select args, access_route, base_url, path, method, user_agent, request_time at time zone 'IST' from api_log order by request_time desc limit 10 offset 0 where user_agent <> 'Ruby';
aviaryan commented 8 years ago

In my opinion too it would be safe but first we should try to know about what it actually is.

Agreed but since this call is not from an android app or a web browser, we can be sure that it is not something that we want to record. Also openshift's client is written in Ruby, so there is a high chance it (OpenShift) has something to do with it.

Changing queries to ignore Ruby is good too but then changing that one query won't help. We will have to change all the queries.

I think we are very safe discarding User-Agent=Ruby values for now.

singhpratyush commented 8 years ago

Changing queries to ignore Ruby is good too but then changing that one query won't help.

It will help in a way that we will not see useless stuff in logs. Rest all the numbers in insights will be effected by the calls but that will not be much sound an issue.

aviaryan commented 8 years ago

Fixed by 96a61b9