anchor.diff:  %% 	`GET /usageManagement/v1/usage/{id}'
   %% 	requests.
   get_usage("auth-" ++ _ = Id, [] = _Query) ->
  +	{ok, MaxItems} = application:get_env(ocs, rest_page_size),
   	try
   		["auth", TimeStamp, Serial] = string:tokens(Id, [$-]),
   		TS = list_to_integer(TimeStamp),
   		N = list_to_integer(Serial),
  -		Events = ocs_log:auth_query(TS, TS, '_', '_', '_', '_'),
  -		case lists:keyfind(N, 2, Events) of
  -			Event when is_tuple(Event) ->
  -				JsonObj = usage_aaa_auth(Event, []),
  -				{struct, Attr} = JsonObj,
  -				{_, Date} = lists:keyfind("date", 1, Attr),
  -				Body = mochijson:encode(JsonObj),
  -				Headers = [{content_type, "application/json"}, {last_modified, Date}],
  -				{ok, Headers, Body};
  -			_ ->
  -				{error, 404}
  +		case query_auth(TS, TS, '_', '_', '_', '_', MaxItems) of
  +			{error, _} ->
  +				{error, 500};
  +			{_, Events} ->
  +				case lists:keyfind(N, 2, Events) of
  +					Event when is_tuple(Event) ->
  +						JsonObj = usage_aaa_auth(Event, []),
  +						{struct, Attr} = JsonObj,
  +						{_, Date} = lists:keyfind("date", 1, Attr),
  +						Body = mochijson:encode(JsonObj),
  +						Headers = [{content_type, "application/json"},
  +								{last_modified, Date}],
  +						{ok, Headers, Body};
  +					_ ->
  +						{error, 404}
  +				end
   		end
   	catch
   		_:_Reason ->
   			{error, 404}
   	end;
   get_usage("acct-" ++ _ = Id, [] = _Query) ->
  +	{ok, MaxItems} = application:get_env(ocs, rest_page_size),
   	try
   		["acct", TimeStamp, Serial] = string:tokens(Id, [$-]),
   		TS = list_to_integer(TimeStamp),
   		N = list_to_integer(Serial),
  -		Events = ocs_log:acct_query(TS, TS, '_', '_', '_'),
  -		case lists:keyfind(N, 2, Events) of
  -			Event when is_tuple(Event) ->
  -				JsonObj = usage_aaa_acct(Event, []),
  -				{struct, Attr} = JsonObj,
  -				{_, Date} = lists:keyfind("date", 1, Attr),
  -				Body = mochijson:encode(JsonObj),
  -				Headers = [{content_type, "application/json"}, {last_modified, Date}],
  -				{ok, Headers, Body};
  -			_ ->
  -				{error, 404}
  +		case query_acct(TS, TS, '_', '_', '_', MaxItems) of
  +			{error, _} ->
  +				{error, 500};
  +			{_, Events} ->
  +				case lists:keyfind(N, 2, Events) of
  +					Event when is_tuple(Event) ->
  +						JsonObj = usage_aaa_acct(Event, []),
  +						{struct, Attr} = JsonObj,
  +						{_, Date} = lists:keyfind("date", 1, Attr),
  +						Body = mochijson:encode(JsonObj),
  +						Headers = [{content_type, "application/json"},
  +								{last_modified, Date}],
  +						{ok, Headers, Body};
  +					_ ->
  +						{error, 404}
  +				end
   		end
   	catch
   		_:_Reason ->
   			{error, 404}
  -	end;
   get_usage(Id, [] = _Query) ->
   	{ok, MaxItems} = application:get_env(ocs, rest_page_size),
   	{ok, Directory} = application:get_env(ocs, ipdr_log_dir),
  
positive.code: 
  %% @hidden
  get_auth_query([] = _Query, Filters) ->
  	{ok, _MaxItems} = application:get_env(ocs, rest_page_size),
  	case ocs_log:auth_query(1, 1, '_', '_', '_', '_') of
  		[] ->
  			{error, 404};
  		Events ->
  			JsonObj = usage_aaa_auth(Events, Filters),
  			JsonArray = {array, JsonObj},
  			Body = mochijson:encode(JsonArray),
  			N = integer_to_list(length(Events)),
  			ContentRange = "items 1-" ++ N ++ "/" ++ N,
  			Headers = [{content_type, "application/json"},
  					{content_range, ContentRange}],
  
negative.code: 
  %% @hidden
  get_acct_query([] = _Query, Filters) ->
  	{ok, MaxItems} = application:get_env(ocs, rest_page_size),
  	Now = erlang:system_time(?MILLISECOND),
  	case query_acct(1, Now, '_', '_', '_', MaxItems) of
  		{0, []} ->
  			{error, 404};
  		{NumItems, Events} ->
  			JsonObj = usage_aaa_acct(Events, Filters),
  			JsonArray = {array, JsonObj},
  			Body = mochijson:encode(JsonArray),
  			N = integer_to_list(NumItems),
  			ContentRange = "items 1-" ++ N ++ "/" ++ N,
  			Headers = [{content_type, "application/json"},
  					{content_range, ContentRange}],
  