# A way to check if record field is already set

**URL:** <https://community.zeek.org/t/a-way-to-check-if-record-field-is-already-set/3163>\
**Category:** Zeek\
**Created:** [June 26, 2014, 1:25pm UTC](https://community.zeek.org/t/a-way-to-check-if-record-field-is-already-set/3163 "2014-06-26T13:25:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user26](https://avatars.discourse-cdn.com/v4/letter/u/7993a0/32.png) [@user26](https://community.zeek.org/u/user26)\
**Post date:** [June 26, 2014, 1:25pm UTC](https://community.zeek.org/t/a-way-to-check-if-record-field-is-already-set/3163/1 "2014-06-26T13:25:56Z")

</div>

Hi,

I wonder if there is any way to check if record field is already set.

For example, I try to access c$http$host for every HTTP request, and in some cases when the host header is empty I get an exception.

I need a way to check if the feild is set before I try to check it.

Thanks,

Omer!

---

<div class="post-metadata">

**Author:** ![Josh\_Liburdi](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@Josh\_Liburdi](https://community.zeek.org/u/Josh_Liburdi)\
**Post date:** [June 26, 2014, 1:43pm UTC](https://community.zeek.org/t/a-way-to-check-if-record-field-is-already-set/3163/2 "2014-06-26T13:43:25Z")

</div>

“?$” will check if a value exists for any field. For your example, put $http?$host in the script before you try to process the host field.

-Josh

On Thu, Jun 26, 2014 at 09:34 AM, עומר עומר

---

<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:41pm UTC](https://community.zeek.org/t/a-way-to-check-if-record-field-is-already-set/3163/3 "2022-05-06T15:41:52Z")

</div>


