I need help reporting on a custom header please?

Avatar
  • Answered
Here is my custom header value:

x-emby-authorization:MediaBrowser Client="Emby Mobile", Device="Chrome 54.0.2840.100", DeviceId="d964b3273b46b32a8d92730e85696094120a787a", Version="3.1.234.0", UserId="1de587e5988caadbe6f60a4f50d792e0"

That is one header with multiple values within it, I would like to report on "MediaBrowser Client" and "Device" in that string..

I know how to add this to my log file, but dont know how to have WLE grab this info and use it.. Any examples you can lend me please?
Avatar
Michael
You need to add modification rules for the table data like the following:

Mediabrowser Client.\\x22(.*?)\\x22 = \1

You can also create a similar table for devices with the following modification rules:

Device.\\x22(.*?)\\x22 = \1

You can find more information on the modification rules at https://www.weblogexpert.com/help/wle...
Avatar
James Kmetz
I'm using nginx, and i have the string added, and weblog sees it, but I dont know how to grab specific items from the server string..... This is what weblog sees:

I want to report on "Mediabrowser Client" and "Device" i need those strings without the "\x22" to be reported on. the \x22 should show up as " not sure why it is not.
Avatar
Michael
What server do you use?

If you use Apache (or another server that produce similar logs), you need to set a log that includes this field. When you specify the log format in Profile Properties > Log Files, you need to specify the server field identifier (%A) instead of the real format for this field. So the server will place the value of this field to the server field.

You can find the list of field for Apache logs at http://httpd.apache.org/docs/current/...

After you verified that the values of the field are shown in the Access Statistics > Servers report, you need to create a custom report on it. You can do it by creating a table in Options > Analysis > Tables. You need to create a table, choose "Server" as the main data on the Data tab, click the Custom button and specify the data modification rules using regular expressions. You can find the description of the mofication rules at https://www.weblogexpert.com/help/wle...

If you send to us at support@weblogexpert.com a sample log file from your site including the field, I'll be able to provide more information on exact settings you need to use in your case.
Avatar
James Kmetz
Thanks Michael, but i still dont understand how i can add MediaBrowser Client="Emby Mobile", Device="Chrome 54.0.2840.100", DeviceId="d964b3273b46b32a8d92730e85696094120a787a", Version="3.1.234.0", UserId="1de587e5988caadbe6f60a4f50d792e0" in the server field and report on individual items within that server field, like just the "Client" or "Device" values, can you give me an example please?

Also is there a section in your manual that tells what each of your variables mean? Like: %h %l %u %t etc..... for example %u = User %I = ? and so on....
Avatar
Michael
The program doesn't support custom fields at the moment, but you can replace one of the fields you don't need (e.g. server - s-computername field in IIS, or username - cs-username field in IIS). In such case you can create a custom table on these value in Options > Report > Tables, and then use the modification rules with regular expressions to extract data you need.

You can find information on creating custom tables at https://www.weblogexpert.com/help/wle...
Avatar
Michael
You can try to use the virtual domain (%v) field. Other fields are usually either too important to be used for other purposes, or have a special meaning.

You can view the list of fields that can be used in the program at https://www.weblogexpert.com/help/wle... , you should check that list of fields in IIS logs. The appropriate identifiers for Apache logs can be found at http://httpd.apache.org/docs/current/...
Avatar
James Kmetz
What other fields are there in weblog that i could use? I have not seen a complete list of fields and identifiers? I am using the username (i think) authenticated user is what i'm using. I guess i can deal with the unnamed Servers if i have to.
Avatar
Michael
You cannot do it with the Server field. You can set the log format to map the field to the username field (%u in Apache logs) and then set the data to "User name" in the custom table.
Avatar
James Kmetz
Ahhh.. That was it... It works....

Now how can I hide the "Unnamed Servers" results from the report totally?

Avatar
Michael
Actually the regex was correct, what was incorrect is that for the regex modification rules = should be replaced with ~= , for example:

Device.\\x22(.*?)\\x22 ~= \1