Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Unable to print client hostname on page log in cups

  1. #1

    Exclamation Unable to print client hostname on page log in cups

    Hello Everyone

    I want to configure cups server, in that i wanted to print client hostname instead of ip address in the the page log of the cups server.

    i am using CUPS 1.7.5 and os "openSUSE Leap" VERSION="42.2"

    i have made setting in cupsd.conf as follows.

    1. HostNameLookups On --
    2. PageLogFormat %p %u %j %T %P %C %{job-billing} %{job-originating-host-name} %{job-name} %{media} %{sides}


    On client side In /etc/hosts file we have enter localhost <hostname>
    but when i go to the address in browser http://localhost:631 >> Administration>> page_log
    we can only see the IP Address instead of hostname in the page log. what else changes is needed????
    Apart from this Everything is working well , need solution for the hostname entity.

    Please Help To Resolve this issue ...!!

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,261

    Default Re: Unable to print client hostname on page log in cups

    Quote Originally Posted by gaurav_salve View Post
    On client side In /etc/hosts file we have enter localhost <hostname>
    Please always show real data, else we will not be able to detect any errors you made. I am not convinced that this is littarally what you have in /etc/hosts. And when you have it, it is incorrect.

    Thh man page says:
    Code:
    IP_address canonical_hostname [aliases...]
    and localhost is not an IP address, nor is <hostname> a valid hostname.
    Henk van Velden

  3. #3

    Default Re: Unable to print client hostname on page log in cups

    Quote Originally Posted by hcvv View Post
    Please always show real data, else we will not be able to detect any errors you made. I am not convinced that this is littarally what you have in /etc/hosts. And when you have it, it is incorrect.

    My system doesn't have the static ip, system gets ip from the dhcp server.

    Thh man page says:
    Code:
    IP_address canonical_hostname [aliases...]
    and localhost is not an IP address, nor is <hostname> a valid hostname.
    I just show the format above actual entries are
    localhost kef-ho-lap
    127.0.0.1 kef-ho-lap
    these are the entries in the /etc/hosts file and i have also check with the static ip and and with FQDN entry in /etc/hosts file but still i am getting only Ip address in the page log not hostname what else changes is needed in the system to get the hostname in the page log of the cups server.

  4. #4
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,553
    Blog Entries
    1

    Default Re: Unable to print client hostname on page log in cups

    The mapping entry needs to be in the /etc/hosts file residing the machine hosting the CUPS server. (It's really only useful for small and static LAN environments where no domain name server is in use.)

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,261

    Default Re: Unable to print client hostname on page log in cups

    Quote Originally Posted by gaurav_salve View Post

    localhost kef-ho-lap
    127.0.0.1 kef-ho-lap
    The first one is an invalid line for /etc/hosts.
    The second one should at least read
    Code:
    127.0.0.1 localhost
    else all references to localhost can not be resolved.
    When you want kef-ho-lap also to be resolved to 127.0.0.1 then make it an alias
    Code:
    127.0.0.1 localhost kef-ho-lap
    When you want a reverse lookup of 127.0.0.1 be resolved as kef-ho-hap instead of localhost, you could change that to
    Code:
    127.0.0.1 kef-ho-hap localhost
    but I am not sure if that is a good idea.

    I do not know if kef-ho-hap is the hostname of the system (which one, CUPS client or CUPS server) you are talking about. Normally the hostname is connected to the IP address of the NIC connected to the LAN, not to 127.0.0.1. This would result in something like:
    Code:
    127.0.0.1 localhost
    192.168.1.15 kef-ho-hap
    And the last one should be both in your client and your server system to have consistency in your network.

    But I can be that I totally misunderstand what you are doing., I only saw your ununderstandable /etc/hosts entry and as long as that is not correct, I doubt you can solve any problem you encounter in this field.
    Henk van Velden

  6. #6
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,553
    Blog Entries
    1

    Default Re: Unable to print client hostname on page log in cups

    My understanding is that the OP appears to want the machine hosting the CUPS server to be able to log the hostname of the client(s) rather than the IP address(es). When that is the case then the desired mapping needs to be in /etc/hosts of the same machine (assuming dnsmasq or some other name server resolution is not employed already).

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,261

    Default Re: Unable to print client hostname on page log in cups

    Quote Originally Posted by deano_ferrari View Post
    My understanding is that the OP appears to want the machine hosting the CUPS server to be able to log the hostname of the client(s) rather than the IP address(es). When that is the case then the desired mapping needs to be in /etc/hosts of the same machine (assuming dnsmasq or some other name server resolution is not employed already).
    I agree with you. The OP is not very clear with what he has done where. Thjer is no good explanation on what he does or did on the CUPS server and what on the CUPS client.
    So trying to recap your and my observations.

    What I am not sure of is if the CUPS client already puts the clients hostname in the conversation with the CUPS server. But then IMHO it would use the hostname derived from the hostname command or similar and not use some IP address active on the client.

    So it is more likely the CUPS server tries to resolve the IP address of the client he is talking to. Then it is clear that resolving must take place on the CUPS server and I am not sure the OP show his /etc/hosts line frim the server (it is vague what he means IMHO and as long as I am not 100% sure of something, then I am suspicious).

    And when the resolving must take place on the CUPS server, that never has anything to do with the word localhost. after ll it must resolve the IP address of the CUPS client as used in the LAN to the hostname of the CUPS client. That could be defined in /etc/hosts like
    Code:
    192.168.1.15 kef-ho-hap
    (assuming that 192.168.1.15 is the IP address of the CUPS client and kef-ho-lap is the hostname of the same).
    But as the OP somewhere states that he is using DHCP (I assume at least on the client), /etc/hosts is not an option and he must use the DNS server of his DHCP server (or other resolvers). In that case changing things in /etc/hosts manually is not a good idea, it will only break things.
    Henk van Velden

  8. #8
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,553
    Blog Entries
    1

    Default Re: Unable to print client hostname on page log in cups

    Yes, more information about the OP's LAN environment would help complete the picture. All too often crucial details are left out and we're left to pay guessing games.

  9. #9

    Default Re: Unable to print client hostname on page log in cups

    Quote Originally Posted by deano_ferrari View Post
    Yes, more information about the OP's LAN environment would help complete the picture. All too often crucial details are left out and we're left to pay guessing games.
    Here is the Complete Scenario of the setup..

    I have opensuse leap 42.2 server
    In that i have configured the dns server along with the cups server in the same machine.
    In this environment dhcp server is configured.
    On cups server add line--In /etc/cups/cupsd.conf -- HostNameLookups On

    New client machine is ubuntu16.04 and windows
    i have not made any changes on client machine,

    i attached the page log format of cups server please refer it.

    kef-prisrv-01 riya.raikar1 1119 [26/Jul/2017:10:04:37 +0530] 1 1 - 10.0.3.163 smbprn.00000737 01 Accounts inputs for July 17.xls - -
    kef-prisrv-01 riya.raikar1 1120 [26/Jul/2017:11:19:54 +0530] 1 1 - 10.0.3.163 smbprn.00000738 YTD QTR 1 riya.xlsx - -
    kef-prisrv-01 nandkishor.yeram 1104 [25/Jul/2017:11:57:10 +0530] 3 1 - 10.0.1.63 Filling Checklist - -

    So i am getting the client ip address but not the hostname..

  10. #10
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,553
    Blog Entries
    1

    Default Re: Unable to print client hostname on page log in cups

    1) Can you ping the client machine by it's hostname, or resolve the hostname using nslookup?

    2) Show us /etc/nsswitch.conf

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •