# field value missing error

**URL:** <https://community.zeek.org/t/field-value-missing-error/4159>\
**Category:** Zeek\
**Created:** [May 13, 2016, 8:01pm UTC](https://community.zeek.org/t/field-value-missing-error/4159 "2016-05-13T20:01:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ps\_sunu](https://avatars.discourse-cdn.com/v4/letter/p/9d8465/32.png) [@ps\_sunu](https://community.zeek.org/u/ps_sunu)\
**Post date:** [May 13, 2016, 8:01pm UTC](https://community.zeek.org/t/field-value-missing-error/4159/1 "2016-05-13T20:01:08Z")

</div>

module Musers;

export {  
redef enum Log::ID += { MUSER::LOG };

type Info: record {

ts: time &log;

id : conn\_id &log &optional;

orig\_user: string &log &optional;

resp\_user: string &log &optional;  
};

global log\_muser: event(rec: Info);  
}

redef record connection += {  
muser: Info &optional;  
};

global host\_name\_user: table[addr] of string &synchronized &write\_expire=7day;  
global host\_name\_user1: table[addr] of string &synchronized &write\_expire=7day;

# Create the Tor log stream and load the Tor list

event bro\_init()  
{  
Log::create\_stream(MUSER::LOG, [$columns=Info, $ev=log\_muser]);

}

event KRB::log\_krb (rec: KRB::Info)  
{

host\_name\_user1[rec$id$orig\_h] = rec$client;

}

event RADIUS::log\_radius (rec: RADIUS::Info)

{

host\_name\_user[rec$id$orig\_h] = rec$username;

}

function set\_session(c: connection)  
{  
if ( ! c?$muser )  
{  
add c$service[“muser”];  
c$muser = [$ts=network\_time(),$id=c$id];  
}  
}

# Function to convert blutmagie Tor flags from count to bool

#function convert\_flag(flag: count): bool  
#{  
#if ( flag == 1 )

# return T;

#else return F;  
#}

# Function to set data in the Tor info record

# Check each new connection for an IP address in the Tor list

event new\_connection(c: connection )  
{

set\_session(c);

if ( c$id$orig\_h in Musers::host\_name\_user )  
c$muser$orig\_user = Musers::host\_name\_user[c$id$orig\_h];

if ( c$id$resp\_h in Musers::host\_name\_user )  
c$muser$resp\_user = Musers::host\_name\_user[c$id$resp\_h];

if ( c$id$orig\_h in Musers::host\_name\_user1 )

#local mist120 = host\_name\_user1[c$id$orig\_h];  
{  
if ( host\_name\_user1[c$id$orig\_h] == /^([A-Za-z0-9.\_.-]+)([/])([\da-zA-Z.-]+).([a-zA-Z.]{2,6})$/ )  
{

print fmt (“orig”);

c$muser$orig\_user = Musers::host\_name\_user1[c$id$orig\_h];

}

if ( c$id$resp\_h in Musers::host\_name\_user1 )

#local mist130 = host\_name\_user1[c$id$resp\_h];

if ( host\_name\_user1[c$id$resp\_h] ==/^([A-Za-z0-9.\_.-]+)([/])([\da-zA-Z.-]+).([a-zA-Z.]{2,6})$/ )  
{

print fmt (“resp”);  
c$muser$resp\_user = Musers::host\_name\_user1[c$id$resp\_h];

}

}

}

event connection\_state\_remove(c: connection)  
{  
if ( c?$muser )  
{  
Log::write(MUSER::LOG, c$muser);  
}  
}

This is my sample code, while running this i am getting below error

virtual-machine:~/Newlogs$ sudo bro -C contrained-delegation/Krb-contrained-delegation.cap Musers.bro  
orig  
1139998844.531337 expression error in ./Musers.bro, line 51: field value missing [Musers::rec$client]

that error line no 51 is marked as red ,any problem in this code ?

Regards,  
Sunu

---

<div class="post-metadata">

**Author:** ![Azoff\_Justin\_S](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Azoff\_Justin\_S](https://community.zeek.org/u/Azoff_Justin_S)\
**Post date:** [May 13, 2016, 8:18pm UTC](https://community.zeek.org/t/field-value-missing-error/4159/2 "2016-05-13T20:18:42Z")

</div>

client is an optional field, you need to wrap that statement with a

&nbsp;&nbsp;&nbsp;&nbsp;if(rec?$client) { }

---

<div class="post-metadata">

**Author:** ![ps\_sunu](https://avatars.discourse-cdn.com/v4/letter/p/9d8465/32.png) [@ps\_sunu](https://community.zeek.org/u/ps_sunu)\
**Post date:** [May 13, 2016, 8:51pm UTC](https://community.zeek.org/t/field-value-missing-error/4159/3 "2016-05-13T20:51:21Z")

</div>

Ya solved Thank you

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:43pm UTC](https://community.zeek.org/t/field-value-missing-error/4159/4 "2022-05-06T15:43:41Z")

</div>


