SRX Services Gateway
SRX Services Gateway

traceoptions or logging for jdhcp

[ Edited ]
‎11-27-2015 02:35 PM

Short story: I have SRX220, getting IP from ISP with DHCP. Software 12.1X46-D35.1. I would like to log IP addresses (and timestamp) what I get from ISP for WAN address.

 

system {
    }
    services {
        ssh;
        dhcp-local-server {
            group DHCP {
                interface vlan.0;
            }
        }
    }
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                dhcp-client {
                    update-server;
                }
            }
        }
    }

Where are the traceoptions? If I put them under system services dhcp, commit will fail with

 Incompatible with 'system services dhcp-local-server group'
[edit interfaces ge-0/0/0 unit 0 family inet]
  'dhcp-client'

 

3 REPLIES 3
SRX Services Gateway
Solution
Accepted by topic author obi-lan
‎11-29-2015 01:53 PM

Re: traceoptions or logging for jdhcp

‎11-27-2015 09:18 PM

I think this is what you are looking for :

 

http://kb.juniper.net/InfoCenter/index?page=content&id=KB26900&actp=search

 

set system processes dhcp-service traceoptions file JDHCPDEBUG
set system processes dhcp-service traceoptions file size 20m
set system processes dhcp-service traceoptions file files 5
set system processes dhcp-service traceoptions flag all

 

Though I would review the flag used in the debug and go with the minimum required.

Thanks,
Hisham

Please accept my comment as a solution, if it helped in resolving your issue, to help guide other commentators and encourage others.
SRX Services Gateway

Re: traceoptions or logging for jdhcp

‎11-29-2015 01:53 PM

Thank you elkadiki, tried different levels (not all) but couldn't hit the correct level yet. So I made match condition for the file:

 

set system processes dhcp-service traceoptions file jdhcp-client-ge0
set system processes dhcp-service traceoptions file size 2m
set system processes dhcp-service traceoptions file files 5
set system processes dhcp-service traceoptions file match "Added new IFA: ifa name ge-0/0/0"
set system processes dhcp-service traceoptions flag all

Seems to provide quite clean log:

 

Nov 29 23:48:32 jdhcpd_ifam_handler: Added new IFA: ifa name ge-0/0/0, family INET, sub 0, addr 91.157.xxx.xxx
Nov 29 23:49:10 jdhcpd_ifam_handler: Added new IFA: ifa name ge-0/0/0, family INET, sub 0, addr 91.157.xxx.xxx
SRX Services Gateway

Re: traceoptions or logging for jdhcp

‎12-03-2015 06:13 PM

That is the best way to do it, even with Syslog that is how I filter the types of messages I require ( only way actually ) . I read this and thought you might be interested in it if you have a syslog server for your network devices :

 

http://www.saidvandeklundert.nl/juniper-syslog-logging.php

 

To quote :

 

 

Remote logging for traceoptions.

 

One last thing I wanted to go over is the fact that you can send traceoptions towards your syslog server as well. The configuration knob for this cannot be found in the [system syslog ] stanza, it's hidden elsewhere. The following configuration command will transfer output from all activated traces to your syslog server:

 

set system tracing destination-override syslog host 10.0.0.13

 

This configuration statement has a system-wide effect. As soon as it is applied, all of the output of your currently activated traces will be send towards the syslog server instead of a local file. You can still choose to store some traces locally. You'll have to configure the 'no-remote-trace' to do so. For example, suppose you are logging all traceoptions to a syslog server but you do not want this to happen for the dhcp-relay traceoptions. If that is the case, you have to add the following to those traceoptions;

 

 

set forwarding-options dhcp-relay traceoptions no-remote-trace
Thanks,
Hisham

Please accept my comment as a solution, if it helped in resolving your issue, to help guide other commentators and encourage others.